Skip to content

Commit 11e244c

Browse files
author
Hugh Delaney
committed
Respond to comments
1 parent 7020207 commit 11e244c

File tree

2 files changed

+11
-34
lines changed

2 files changed

+11
-34
lines changed

sycl/include/sycl/detail/pi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,6 +1405,7 @@ __SYCL_EXPORT pi_result piextMemGetNativeHandle(pi_mem mem,
14051405
/// Gets the native handle of a PI mem object on a particular device
14061406
///
14071407
/// \param mem is the PI mem to get the native handle of.
1408+
/// \param dev is the PI device that the native allocation will be resident on.
14081409
/// \param nativeHandle is the native handle of mem.
14091410
__SYCL_EXPORT pi_result piextMemGetNativeHandleExp(
14101411
pi_mem mem, pi_device dev, pi_native_handle *nativeHandle);

sycl/test-e2e/HostInteropTask/interop-task-hip.cpp

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// FIXME: the rocm include path and link path are highly platform dependent,
2-
// we should set this with some variable instead
2+
// we should set this with some variable instead.
33
// RUN: %{build} -o %t.out -I/opt/rocm/include -L/opt/rocm/lib -lamdhip64
44
// RUN: %{run} %t.out
55
// REQUIRES: hip
@@ -42,7 +42,6 @@ void copy(buffer<DataT, 1> &Src, buffer<DataT, 1> &Dst, queue &Q) {
4242
auto HipStream = IH.get_native_queue<backend::ext_oneapi_hip>();
4343
auto SrcMem = IH.get_native_mem<backend::ext_oneapi_hip>(SrcA);
4444
auto DstMem = IH.get_native_mem<backend::ext_oneapi_hip>(DstA);
45-
cl_event Event;
4645

4746
if (hipMemcpyWithStream(DstMem, SrcMem, sizeof(DataT) * SrcA.get_count(),
4847
hipMemcpyDefault, HipStream) != hipSuccess) {
@@ -77,14 +76,14 @@ void init(buffer<DataT, 1> &B1, buffer<DataT, 1> &B2, queue &Q) {
7776
auto Acc2 = B2.template get_access<mode::write>(CGH);
7877

7978
CGH.parallel_for<Init<DataT>>(BUFFER_SIZE, [=](item<1> Id) {
80-
Acc1[Id] = -1;
81-
Acc2[Id] = -2;
79+
Acc1[Id] = B1Init;
80+
Acc2[Id] = B2Init;
8281
});
8382
});
8483
}
8584

86-
// A test that uses OpenCL interop to copy data from buffer A to buffer B, by
87-
// getting cl_mem objects and calling the clEnqueueBufferCopy. Then run a SYCL
85+
// A test that uses HIP interop to copy data from buffer A to buffer B, by
86+
// getting HIP ptrs and calling the hipMemcpyWithStream. Then run a SYCL
8887
// kernel that modifies the data in place for B, e.g. increment one, then copy
8988
// back to buffer A. Run it on a loop, to ensure the dependencies and the
9089
// reference counting of the objects is not leaked.
@@ -93,10 +92,10 @@ void test1(queue &Q) {
9392
buffer<int, 1> Buffer1{BUFFER_SIZE};
9493
buffer<int, 1> Buffer2{BUFFER_SIZE};
9594

96-
// init the buffer with a'priori invalid data
95+
// Init the buffer with a'priori invalid data.
9796
init<int, -1, -2>(Buffer1, Buffer2, Q);
9897

99-
// Repeat a couple of times
98+
// Repeat a couple of times.
10099
for (size_t Idx = 0; Idx < COUNT; ++Idx) {
101100
copy(Buffer1, Buffer2, Q);
102101
modify(Buffer2, Q);
@@ -115,10 +114,10 @@ void test2(queue &Q) {
115114
buffer<int, 1> Buffer1{BUFFER_SIZE};
116115
buffer<int, 1> Buffer2{BUFFER_SIZE};
117116

118-
// init the buffer with a'priori invalid data
117+
// Init the buffer with a'priori invalid data.
119118
init<int, -1, -2>(Buffer1, Buffer2, Q);
120119

121-
// Repeat a couple of times
120+
// Repeat a couple of times.
122121
for (size_t Idx = 0; Idx < COUNT; ++Idx) {
123122
copy(Buffer1, Buffer2, Q);
124123
modify(Buffer2, Q);
@@ -128,28 +127,7 @@ void test2(queue &Q) {
128127
checkBufferValues(Buffer2, COUNT - 1);
129128
}
130129

131-
// Same as above but with queue constructed out of context
132-
void test2_1(queue &Q) {
133-
static constexpr int COUNT = 4;
134-
buffer<int, 1> Buffer1{BUFFER_SIZE};
135-
buffer<int, 1> Buffer2{BUFFER_SIZE};
136-
137-
device Device;
138-
auto Context = context(Device);
139-
// init the buffer with a'priori invalid data
140-
init<int, -1, -2>(Buffer1, Buffer2, Q);
141-
142-
// Repeat a couple of times
143-
for (size_t Idx = 0; Idx < COUNT; ++Idx) {
144-
copy(Buffer1, Buffer2, Q);
145-
modify(Buffer2, Q);
146-
copy(Buffer2, Buffer1, Q);
147-
}
148-
checkBufferValues(Buffer1, COUNT - 1);
149-
checkBufferValues(Buffer2, COUNT - 1);
150-
}
151-
152-
// Check that a single host-interop-task with a buffer will work
130+
// Check that a single host-interop-task with a buffer will work.
153131
void test3(queue &Q) {
154132
buffer<int, 1> Buffer{BUFFER_SIZE};
155133

@@ -179,7 +157,6 @@ void test4(queue &Q) {
179157
void tests(queue &Q) {
180158
test1(Q);
181159
test2(Q);
182-
test2_1(Q);
183160
test3(Q);
184161
test4(Q);
185162
}
@@ -193,7 +170,6 @@ int main() {
193170
std::rethrow_exception(*ExceptionList.begin());
194171
});
195172
tests(Q);
196-
tests(Q);
197173
std::cout << "Test PASSED" << std::endl;
198174
return 0;
199175
}

0 commit comments

Comments
 (0)