- 
                Notifications
    
You must be signed in to change notification settings  - Fork 794
 
[SYCL][E2E] use any-device-is in requires lines #15816
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,4 @@ | ||||||||
| // REQUIRES: linux, (gpu && level_zero), cpu | ||||||||
| // REQUIRES: linux, (gpu && level_zero), any-device-is-cpu | ||||||||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 
        Suggested change
       
    
 I general I have a very same question about how switching to   | 
||||||||
| // RUN: %{build} %device_asan_flags -DMALLOC_DEVICE -O2 -g -o %t | ||||||||
| // RUN: env SYCL_PREFER_UR=1 UR_LAYER_ASAN_OPTIONS="detect_kernel_arguments:1" %{run} not %t 2>&1 | FileCheck --check-prefixes CHECK,CHECK-DEVICE %s | ||||||||
| 
     | 
||||||||
| 
          
            
          
           | 
    ||||||||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -6,7 +6,7 @@ | |
| // | ||
| //===---------------------------------------------------------------------===// | ||
| 
     | 
||
| // REQUIRES: cpu, gpu, accelerator | ||
| // REQUIRES: any-device-is-cpu, any-device-is-gpu, any-device-is-accelerator | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, at this point I've probably realized how it works.  Therefore, in an environment where we have all three types of devices, all three  Even though I appreciate the change, I don't think that it should be accepted without update to the documentation. Otherwise, someone could introduce a new incorrect test literally tomorrow. Moreover, I would maybe think about alternative solutions here. Like, my first though is: why  Would it be better to rename  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not just use C expression which is intuitive to everyone? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to get rid of "," expression There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 
 100% agree with the documentation change given how easy it is to make this error. Not to mention that it doesn't just affect  
 This would still have the issue that this PR is trying to fix, how we currently handle requires  
 Honestly, I like this solution, we could structure the tests slightly differently in the two cases you mention. If the intention is to run because a GPU is present in the system we would likely also add another device to the requires, and include logic (either through device selectors, or env variables) to make sure we are running on the device we intend. In the case we want to specifically only run on a GPU we would use  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 
 I see. Some of my tests require both cpu and gpu device available, but it's fine to ignore these tests if we don't have this environment currently. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 
 Should we also consider renaming of  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm in favor of  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if the true intent of "REQUIRES: cpu,gpu,accelerator" is tested on any of "cpu, gpu, acc", why not just rewrite it to "REQUIRES: cpu || gpu || accelerator"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 
 Do we really need "it requires a GPU to be present on the system, but can be launched on other device" this case? It means this test needs to run on a machine which has both cpu and gpu, but this test will only run on cpu (I don't understand this need, it seems "REQUIRE: cpu && gpu" is more reasonable). 
 I also not quite understand this requirement, though. I think "REQUIRE: cpu || gpu" is more flexible. And by default, It means this test can be tested on cpu or gpu, it doesn't require the machine have both cpu and gpu. If the machine only have cpu, it's fine to just test cpu. If the machine have cpu and gpu, it will test on cpu and gpu separately (run twice). It means, it needs a machine have both cpu and gpu, and this test needs these devices both available (run once). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean "REQUIRE" is used to control "ONEAPI_DEVICE_SELECTOR", export ONEAPI_DEVICE_SELECTOR=opencl:cpu export ONEAPI_DEVICE_SELECTOR=level_zero:gpu,opencl:cpu  | 
||
| 
     | 
||
| // RUN: %clangxx -fsycl %S/Inputs/filter_list_queries.cpp -o %t.out | ||
| 
     | 
||
| 
          
            
          
           | 
    ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -11,7 +11,7 @@ | |
| // Checks that no device is selected when no device of desired type is | ||
| // available. | ||
| // | ||
| // REQUIRES: cpu,gpu,accelerator | ||
| // REQUIRES: any-device-is-cpu, any-device-is-gpu, any-device-is-accelerator | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should not be an E2E test at all, it should be moved to unit-tests where we can emulate all environments and check that we query the right device, or just directly check that we parse the env variable correctly, similar to what I did in #15774  | 
||
| 
     | 
||
| #include <iostream> | ||
| 
     | 
||
| 
          
            
          
           | 
    ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| // REQUIRES: cpu, gpu, accelerator, opencl | ||
| // REQUIRES: any-device-is-cpu, any-device-is-gpu, any-device-is-accelerator, any-device-is-opencl | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, this should not be an E2E test. This comment can be applied to some other tests as well, but I will repeat it on those which are the first candidates for the rewrite.  | 
||
| 
     | 
||
| // RUN: %{build} -o %t.out | ||
| 
     | 
||
| 
          
            
          
           | 
    ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| // REQUIRES: hip_amd, opencl, gpu, cpu | ||
| // REQUIRES: hip_amd, any-device-is-opencl, any-device-is-gpu, any-device-is-cpu | ||
| 
     | 
||
| // RUN: %clangxx -fsycl -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=gfx906 -fsycl-targets=amdgcn-amd-amdhsa %S/Inputs/is_compatible_with_env.cpp -o %t.out | ||
| 
     | 
||
| // RUN: env ONEAPI_DEVICE_SELECTOR=hip:gpu %{run} %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:gpu %{run} not %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:cpu %{run} not %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=hip:gpu %{run-unfiltered-devices} %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:gpu %{run-unfiltered-devices} not %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:cpu %{run-unfiltered-devices} not %t.out | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| // REQUIRES: cuda, opencl, gpu, cpu | ||
| // REQUIRES: any-device-is-cuda, any-device-is-opencl, any-device-is-gpu, any-device-is-cpu | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need more unit-tests! :)  | 
||
| 
     | 
||
| // RUN: %clangxx -fsycl -fsycl-targets=nvptx64-nvidia-cuda %S/Inputs/is_compatible_with_env.cpp -o %t.out | ||
| 
     | 
||
| // RUN: env ONEAPI_DEVICE_SELECTOR=cuda:gpu %{run} %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:gpu %{run} not %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:cpu %{run} not %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=cuda:gpu %{run-unfiltered-devices} %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:gpu %{run-unfiltered-devices} not %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:cpu %{run-unfiltered-devices} not %t.out | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,8 +1,10 @@ | ||
| // REQUIRES: ocloc, level_zero, gpu, cpu | ||
| // XFAIL: * | ||
| // XFAIL-TRACKER: https://github.com/intel/llvm/issues/15819 | ||
| // REQUIRES: ocloc, any-device-is-level_zero, any-device-is-gpu, any-device-is-cpu | ||
| 
     | 
||
| // RUN: %clangxx -fsycl -fsycl-targets=spir64_fpga,spir64_gen -Xsycl-target-backend "-device *" %S/Inputs/is_compatible_with_env.cpp -o %t.out | ||
| 
     | 
||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:cpu %{run} not %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:fpga %{run} %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:gpu %{run} %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=level_zero:gpu %{run} %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:cpu %{run-unfiltered-devices} not %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:fpga %{run-unfiltered-devices} %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:gpu %{run-unfiltered-devices} %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=level_zero:gpu %{run-unfiltered-devices} %t.out | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| // REQUIRES: opencl-aot, accelerator, gpu, cpu | ||
| // REQUIRES: opencl-aot, any-device-is-accelerator, any-device-is-gpu, any-device-is-cpu | ||
| 
     | 
||
| // RUN: %clangxx -fsycl -fsycl-targets=spir64_fpga %S/Inputs/is_compatible_with_env.cpp -o %t.out | ||
| 
     | 
||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:fpga %{run} %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=*:gpu %{run} not %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:cpu %{run} not %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:fpga %{run-unfiltered-devices} %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=*:gpu %{run-unfiltered-devices} not %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:cpu %{run-unfiltered-devices} not %t.out | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| // REQUIRES: ocloc, gpu, level_zero, cpu | ||
| // REQUIRES: ocloc, any-device-is-gpu, any-device-is-level_zero, any-device-is-cpu | ||
| 
     | 
||
| // RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend "-device *" %S/Inputs/is_compatible_with_env.cpp -o %t.out | ||
| 
     | 
||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:gpu %{run} %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=level_zero:gpu %{run} %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:cpu %{run} not %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:gpu %{run-unfiltered-devices} %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=level_zero:gpu %{run-unfiltered-devices} %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:cpu %{run-unfiltered-devices} not %t.out | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| // REQUIRES: opencl-aot, cpu, gpu, level_zero | ||
| // REQUIRES: opencl-aot, any-device-is-cpu, any-device-is-gpu, any-device-is-level_zero | ||
| 
     | 
||
| // RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 %S/Inputs/is_compatible_with_env.cpp -o %t.out | ||
| 
     | 
||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:cpu %{run} %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:gpu %{run} not %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=level_zero:gpu %{run} not %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:cpu %{run-unfiltered-devices} %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=opencl:gpu %{run-unfiltered-devices} not %t.out | ||
| // RUN: env ONEAPI_DEVICE_SELECTOR=level_zero:gpu %{run-unfiltered-devices} not %t.out | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -2,8 +2,8 @@ | |
| // on opencl & level-zero backends | ||
| // (because only SPIR-V supports specialization constants natively) | ||
| 
     | 
||
| // FIXME: This set is never satisfied all at once in our infrastructure. | ||
| // REQUIRES: opencl, level-zero, cpu, gpu, opencl-aot, ocloc | ||
| // REQUIRES: any-device-is-opencl, any-device-is-level_zero, opencl-aot, ocloc | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm mostly sure that this can be turned into a unit-test as well  | 
||
| // UNSUPPORTED: accelerator | ||
| 
     | 
||
| // RUN: %clangxx -fsycl -DJIT %s -o %t.out | ||
| // RUN: %{run} %t.out | ||
| 
          
            
          
           | 
    ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite understand how it is a correct fix. If
,is treated as&&inREQUIRESdirective, then we previously had:cpu && gpu && accwhich is never true. Now we haveany-device-is-cpu && any-device-is-gpu && any-device-is-accelerator.If the expression is computed per single device, then even with the latter there will only be
truefor just one ofany-device-is, meaning the overall expression evaluates tofalseanyways.Should we just drop those device requirements from the test and instead use
UNSUPPORTEDto filter out environments where the test can't be run (like CUDA)?Considering that there are no device types other than CPU, GPU and ACC, do we ever need to require them all? My understanding is that it is safe to assume that
check-sycl-e2eis always launched with an environment with at least one device. And if it is not the case yet, we should maybe introduce a check like this tolit.cfg.pyThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old features are per-device, new features are per-llvm-lit invocation. They were created to target this scenario exactly.