Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

[SYCL][CUDA] Add SM version check to bfloat16 CUDA test #1423

Merged
merged 2 commits into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
27 changes: 23 additions & 4 deletions SYCL/BFloat16/bfloat16_type.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// RUN: %if cuda %{%clangxx -fsycl -fsycl-targets=%sycl_triple -DUSE_CUDA_SM80=1 -Xsycl-target-backend --cuda-gpu-arch=sm_80 %s -o %t.out %}
// RUN: %if cuda %{%GPU_RUN_PLACEHOLDER %t.out %}

Choose a reason for hiding this comment

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

So there is an sm_80 in the CI now? Useful to know.

Copy link
Author

@steffenlarsen steffenlarsen Nov 29, 2022

Choose a reason for hiding this comment

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

I don't think there is, but with the check we just skip if the device does not support it. I'd argue it is generally a bad practice to write the tests in a way that makes them dependent on what we have in CI, as anyone running it on other systems would see failures if we do. You could argue though that skipping without more information than a hidden message is also a bad practice, but in my opinion it is the lesser evil. 😄

Choose a reason for hiding this comment

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

I see. Yeah make sense thanks!

// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// TODO currently the feature isn't supported on FPGA.
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
// RUNx: %ACC_RUN_PLACEHOLDER %t.out
//
// Not currently supported on HIP. CUDA has additional requirements so it is
// tested in bfloat16_type_cuda.cpp.
// UNSUPPORTED: cuda || hip
// Not currently supported on HIP.
// UNSUPPORTED: hip

//==----------- bfloat16_type.cpp - SYCL bfloat16 type test ----------------==//
//
Expand All @@ -18,4 +19,22 @@

#include "bfloat16_type.hpp"

int main() { return run_tests(); }
int main() {

#ifdef USE_CUDA_SM80
// Special build for SM80 CUDA.
sycl::device Dev{default_selector_v};
if (Dev.get_platform().get_backend() != backend::ext_oneapi_cuda) {
std::cout << "Test skipped; CUDA run was not run with CUDA device."
<< std::endl;
return 0;
}
if (std::stof(Dev.get_info<sycl::info::device::backend_version>()) < 8.0f) {
std::cout << "Test skipped; CUDA device does not support SM80 or newer."
<< std::endl;
return 0;
}
#endif

return run_tests();
}
27 changes: 0 additions & 27 deletions SYCL/BFloat16/bfloat16_type_cuda.cpp

This file was deleted.