Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion sycl/gdb/libsycl.so-gdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,23 @@ def offset(self, dim):
def data(self):
return self.payload()['MData']

class HostAccessorLocal(HostAccessor):
"""For Host device memory layout"""

def index(self, arg):
if arg.type.code == gdb.TYPE_CODE_INT:
return int(arg)
# https://github.com/intel/llvm/blob/97272b7ebd569bfa13811913a31e30f926559217/sycl/include/CL/sycl/accessor.hpp#L1049-L1053
result = 0;
for dim in range(self.depth):
result = result * \
self.payload()['MSize']['common_array'][dim] + \
arg['common_array'][dim];
return result;

def data(self):
return self.payload()['MMem']

class DeviceAccessor(Accessor):
"""For CPU/GPU memory layout"""

Expand Down Expand Up @@ -88,7 +105,8 @@ def __call__(self, obj, arg):
# try all accessor implementations until one of them works:
accessors = [
DeviceAccessor(obj, self.result_type, self.depth),
HostAccessor(obj, self.result_type, self.depth)
HostAccessor(obj, self.result_type, self.depth),
HostAccessorLocal(obj, self.result_type, self.depth)
]
for accessor in accessors:
try:
Expand Down
10 changes: 9 additions & 1 deletion sycl/test/gdb/accessors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@ typedef cl::sycl::accessor<int, 1, cl::sycl::access::mode::read> dummy;
// CHECK: CXXRecordDecl {{.*}} class AccessorBaseHost definition
// CHECK-NOT: CXXRecordDecl {{.*}} definition
// CHECK: FieldDecl {{.*}} referenced impl {{.*}}:'std::shared_ptr<sycl::detail::AccessorImplHost>'

// LocalAccessorImplHost must have MSize and MMem fields

// CHECK: CXXRecordDecl {{.*}} class LocalAccessorImplHost definition
// CHECK-NOT: CXXRecordDecl {{.*}} definition
// CHECK: FieldDecl {{.*}} referenced MSize
// CHECK-NOT: CXXRecordDecl {{.*}} definition
// CHECK: FieldDecl {{.*}} referenced MMem

// CHECK: CXXRecordDecl {{.*}} class accessor definition
// CHECK-NOT: CXXRecordDecl {{.*}} definition
// CHECK: public {{.*}}:'sycl::detail::AccessorBaseHost'