Skip to content

[SYCL][CUDA] Eliminate incorrect assertions and enable cuda usm tests #2557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 29, 2020
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
6 changes: 3 additions & 3 deletions sycl/plugins/cuda/pi_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4133,7 +4133,7 @@ pi_result cuda_piextUSMHostAlloc(void **result_ptr, pi_context context,
} catch (pi_result error) {
result = error;
}
assert(reinterpret_cast<std::uintptr_t>(*result_ptr) % alignment == 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the issue when alignment == 0 - but removing it there are no checks that the allocation respects the alignment ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fwyzard, do you suggest adding something like:

assert(alignment && (reinterpret_cast<std::uintptr_t>(*result_ptr) % alignment == 0));

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was actually thinking

assert(alignment == 0 || reinterpret_cast<std::uintptr_t>(*result_ptr) % alignment == 0);

since alignment == 0 means no alignment requirements IIRC ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. This seems to be an easy change: the tests are already enabled, so it should be just three new lines of code in pi_cuda.cpp.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#2831 recovers assertions.


return result;
}

Expand All @@ -4154,7 +4154,7 @@ pi_result cuda_piextUSMDeviceAlloc(void **result_ptr, pi_context context,
} catch (pi_result error) {
result = error;
}
assert(reinterpret_cast<std::uintptr_t>(*result_ptr) % alignment == 0);

return result;
}

Expand All @@ -4176,7 +4176,7 @@ pi_result cuda_piextUSMSharedAlloc(void **result_ptr, pi_context context,
} catch (pi_result error) {
result = error;
}
assert(reinterpret_cast<std::uintptr_t>(*result_ptr) % alignment == 0);

return result;
}

Expand Down
5 changes: 0 additions & 5 deletions sycl/test/basic_tests/queue/queue_parallel_for_generic.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// XFAIL: cuda
// piextUSM*Alloc functions for CUDA are not behaving as described in
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/USM.adoc
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/cl_intel_unified_shared_memory.asciidoc
//
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
// RUN: %ACC_RUN_PLACEHOLDER %t.out
Expand Down
1 change: 0 additions & 1 deletion sycl/test/inorder_queue/in_order_dmemll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
// RUN: %GPU_RUN_PLACEHOLDER %t1.out
//
// XFAIL: cuda
//==----------- ordered_dmemll.cpp - Device Memory Linked List test --------==//
// It uses an ordered queue where explicit waiting is not necessary between
// kernels
Expand Down
4 changes: 0 additions & 4 deletions sycl/test/usm/allocator_equal.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// piextUSM*Alloc functions for CUDA are not behaving as described in
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/USM.adoc
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/cl_intel_unified_shared_memory.asciidoc
//
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t1.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t1.out
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
Expand Down
4 changes: 0 additions & 4 deletions sycl/test/usm/badmalloc.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
// UNSUPPORTED: windows
// XFAIL: cuda
// piextUSM*Alloc functions for CUDA are not behaving as described in
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/USM.adoc
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/cl_intel_unified_shared_memory.asciidoc
//
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t1.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t1.out
Expand Down
5 changes: 0 additions & 5 deletions sycl/test/usm/depends_on.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// XFAIL: cuda
// piextUSM*Alloc functions for CUDA are not behaving as described in
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/USM.adoc
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/cl_intel_unified_shared_memory.asciidoc
//
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t1.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t1.out
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
Expand Down
5 changes: 0 additions & 5 deletions sycl/test/usm/dmemll.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// XFAIL: cuda
// piextUSM*Alloc functions for CUDA are not behaving as described in
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/USM.adoc
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/cl_intel_unified_shared_memory.asciidoc
//
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t1.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t1.out
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
Expand Down
2 changes: 0 additions & 2 deletions sycl/test/usm/fill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// XFAIL: cuda
// piextUSM*Alloc functions for CUDA are not behaving as described in
//
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t1.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t1.out
Expand Down
5 changes: 0 additions & 5 deletions sycl/test/usm/hmemll.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// XFAIL: cuda
// piextUSM*Alloc functions for CUDA are not behaving as described in
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/USM.adoc
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/cl_intel_unified_shared_memory.asciidoc
//
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t1.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t1.out
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
Expand Down
4 changes: 0 additions & 4 deletions sycl/test/usm/memadvise.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// XFAIL: cuda
// SYCL runtime and piextUSM*Alloc functions for CUDA not behaving as described
// in: https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/USM.adoc
//
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t1.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t1.out
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
Expand Down
4 changes: 0 additions & 4 deletions sycl/test/usm/memcpy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// XFAIL: cuda
// piextUSM*Alloc functions for CUDA are not behaving as described in
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/USM.adoc
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/cl_intel_unified_shared_memory.asciidoc
//
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t1.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t1.out
Expand Down
5 changes: 0 additions & 5 deletions sycl/test/usm/memset.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// XFAIL: cuda
// piextUSM*Alloc functions for CUDA are not behaving as described in
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/USM.adoc
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/cl_intel_unified_shared_memory.asciidoc
//
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t1.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t1.out
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
Expand Down
5 changes: 0 additions & 5 deletions sycl/test/usm/mixed.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// XFAIL: cuda
// piextUSM*Alloc functions for CUDA are not behaving as described in
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/USM.adoc
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/cl_intel_unified_shared_memory.asciidoc
//
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t1.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t1.out
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
Expand Down
5 changes: 0 additions & 5 deletions sycl/test/usm/mixed2.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// XFAIL: cuda
// piextUSM*Alloc functions for CUDA are not behaving as described in
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/USM.adoc
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/cl_intel_unified_shared_memory.asciidoc
//
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t1.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t1.out
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
Expand Down
5 changes: 0 additions & 5 deletions sycl/test/usm/mixed2template.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// XFAIL: cuda
// piextUSM*Alloc functions for CUDA are not behaving as described in
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/USM.adoc
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/cl_intel_unified_shared_memory.asciidoc
//
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t1.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t1.out
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
Expand Down
5 changes: 0 additions & 5 deletions sycl/test/usm/mixed_queue.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// XFAIL: cuda
// piextUSM*Alloc functions for CUDA are not behaving as described in
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/USM.adoc
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/cl_intel_unified_shared_memory.asciidoc
//
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t1.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t1.out
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
Expand Down
3 changes: 0 additions & 3 deletions sycl/test/usm/pfor_flatten.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// UNSUPPORTED: cuda
// CUDA does not support the unnamed lambda extension.
//
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -fsycl-unnamed-lambda -fsycl-dead-args-optimization %s -o %t1.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t1.out
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
Expand Down
3 changes: 0 additions & 3 deletions sycl/test/usm/pfor_flatten_range_shortcut.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// UNSUPPORTED: cuda
// CUDA does not support the unnamed lambda extension.
//
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -fsycl-unnamed-lambda %s -o %t1.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t1.out
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
Expand Down
5 changes: 0 additions & 5 deletions sycl/test/usm/queue_wait.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// XFAIL: cuda
// piextUSM*Alloc functions for CUDA are not behaving as described in
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/USM.adoc
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/cl_intel_unified_shared_memory.asciidoc
//
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
Expand Down
5 changes: 0 additions & 5 deletions sycl/test/usm/smemll.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// XFAIL: cuda
// piextUSM*Alloc functions for CUDA are not behaving as described in
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/USM.adoc
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/cl_intel_unified_shared_memory.asciidoc
//
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t1.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t1.out
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
Expand Down