- 
                Notifications
    You must be signed in to change notification settings 
- Fork 794
[SYCL] Align get_info<info::device::version>() with the SYCL spec #2507
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
      
      
            bader
  merged 9 commits into
  intel:sycl
from
DenisBakhvalov:private/dbakhval-device-get_info
  
      
      
   
  Oct 12, 2020 
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            9 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      e39575e
              
                [SYCL] - Align get_info<info::device::version>() with the SYCL spec
              
              
                DenisBakhvalov 8d4876a
              
                Fixed review comments
              
              
                DenisBakhvalov 7c6b856
              
                Revert "Fixed review comments"
              
              
                DenisBakhvalov db2b321
              
                Fixed review comments
              
              
                DenisBakhvalov 1b40b9f
              
                Run clang-format on sycl/test/basic_tests/parallel_for_range.cpp
              
              
                DenisBakhvalov da074db
              
                Added more tests for get_info<info::device::version>()
              
              
                DenisBakhvalov 2da0428
              
                Fixed basic_tests/parallel_for_range.cpp
              
              
                DenisBakhvalov b66ec6e
              
                Updated sub_group/broadcast tests
              
              
                DenisBakhvalov 5bd0760
              
                Fixed review comments
              
              
                DenisBakhvalov File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out | ||
| // RUN: env SYCL_DEVICE_TYPE=HOST %t.out | ||
| // RUN: env %CPU_RUN_PLACEHOLDER %t.out | ||
| // RUN: env %GPU_RUN_PLACEHOLDER %t.out | ||
| // RUN: env %ACC_RUN_PLACEHOLDER %t.out | ||
|  | ||
| //==--------info_ocl_version.cpp - SYCL objects get_info() test ------------==// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|  | ||
| #include <CL/sycl.hpp> | ||
| #include <iostream> | ||
| #include <regex> | ||
| #include <string> | ||
|  | ||
| using namespace cl::sycl; | ||
|  | ||
| // This test checks that cl::sycl::info::device::version | ||
| // is returned in a form: <major_version>.<minor_version> | ||
|  | ||
| int main() { | ||
| default_selector selector; | ||
| device dev(selector.select_device()); | ||
| auto ocl_version = dev.get_info<info::device::version>(); | ||
| std::cout << ocl_version << std::endl; | ||
| const std::regex oclVersionRegex("[0-9]\\.[0-9]"); | ||
| if (!std::regex_match(ocl_version, oclVersionRegex)) { | ||
| std::cout << "Failed" << std::endl; | ||
| return 1; | ||
| } | ||
| std::cout << "Passed" << std::endl; | ||
| return 0; | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| // XFAIL: cpu | ||
| // UNSUPPORTED: cuda | ||
| // CUDA compilation and runtime do not yet support sub-groups. | ||
|  | ||
|  | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| // XFAIL: cpu | ||
| // UNSUPPORTED: cuda | ||
| // CUDA compilation and runtime do not yet support sub-groups. | ||
|  | ||
|  | ||
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
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.
the function is not robust. If version string contains "bla X.Y.Z bla" it will report X.Y.Z which also violates spec.
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.
Yes, I know. It will also violate the spec if the plugin call returns the string without a dot, like 'XYZ'. What we should do in this case? Throwing an exception seems too strict, isn't it?
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.
can we make sure that if format of the version returned by BE does not fit our requirements (e.g. no dot, X.Y.Z, X.Y at the end of string) the user friendly string will be displayed (e.g. the whole string returned by BE, X.Y(.Z is ignored), X.Y).
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.
Ok. This is what I'm doing if the string doesn't have the dot. E.g. For string "bla XdotY bla" I return "bla XdotY bla".
I'm not sure how you define "user friendly string".