Skip to content

Commit c417b29

Browse files
committed
debug about getting ptr device
1 parent d301bdf commit c417b29

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/ATen/native/xpu/Copy.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ void memcpyAsync(
7171
Device dst_device = iter.device(0);
7272
Device src_device = iter.device(1);
7373
if (dst_device == src_device) {
74+
std::cout << "zl_debug: go to same device and specialized kernel" << std::endl;
7475
copy_kernel(iter);
7576
} else {
77+
std::cout << "zl_debug: go to sycl copy kernel" << std::endl;
7678
TORCH_INTERNAL_ASSERT(p2p_enabled == true);
7779
auto dst = (char*)iter.data_ptr(0);
7880
auto src = (char*)iter.data_ptr(1);

src/xccl/XPUSymmetricMemory.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ at::Tensor XPUSymmetricMemory::get_buffer(
132132
" bytes)");
133133
auto data_ptr = reinterpret_cast<uint8_t*>(buffers_[rank]) +
134134
storage_offset * element_size;
135-
auto device = c10::Device(c10::DeviceType::XPU, local_device_idx_);
135+
// check the device of this device buffer
136+
auto ptr_to_device_id = c10::xpu::get_device_idx_from_pointer(data_ptr);
137+
auto device = c10::Device(c10::DeviceType::XPU, ptr_to_device_id);
136138
auto options = at::TensorOptions().dtype(dtype).device(device);
137139

138140
return at::for_blob(data_ptr, sizes)

0 commit comments

Comments
 (0)