Skip to content
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

[SYCL] Align get_info<info::device::version>() with the SYCL spec #2507

Merged
merged 9 commits into from
Oct 12, 2020

Conversation

DenisBakhvalov
Copy link
Contributor

According to the SYCL spec, cl::sycl::info::device::version
should be returned in a form: <major_version>.<minor_version>

This patch trims the string returned from the piDeviceGetInfo call.
For example, for the string "OpenCL 2.1 (Build 0)",
it will return "2.1".

According to the SYCL spec, cl::sycl::info::device::version
should be returned in a form: `<major_version>.<minor_version>`

This patch trims the string returned from the piDeviceGetInfo call.
For example, for the string "OpenCL 2.1 (Build 0)",
it will return "2.1".
Copy link
Contributor

@dm-vodopyanov dm-vodopyanov left a comment

Choose a reason for hiding this comment

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

Please update basic_tests/parallel_for_range, sub_group/broadcast and sub_group/broadcast_fp64 tests, and add test cases for L0, CUDA, OpenCL CPU, OpenCL ACC and host device.

sycl/test/plugins/sycl-ls-gpu-opencl.cpp Outdated Show resolved Hide resolved
leftPos++;

auto rightPos = result.find(' ', dotPos);
return result.substr(leftPos, rightPos - leftPos);
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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).

Copy link
Contributor Author

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".

sycl/test/basic_tests/info_ocl_version-cuda.cpp Outdated Show resolved Hide resolved
sycl/test/basic_tests/info_ocl_version.cpp Outdated Show resolved Hide resolved
sycl/test/basic_tests/parallel_for_range.cpp Show resolved Hide resolved
@vladimirlaz
Copy link
Contributor

you updated info::device::version but spec contains also info::platform::version with the same wording. Could you please ensure that is follows the spec as well.

@DenisBakhvalov
Copy link
Contributor Author

you updated info::device::version but spec contains also info::platform::version with the same wording. Could you please ensure that is follows the spec as well.

Sure, I can do that. Don't you mind I do it in a separate patch?

@vladimirlaz
Copy link
Contributor

you updated info::device::version but spec contains also info::platform::version with the same wording. Could you please ensure that is follows the spec as well.

Sure, I can do that. Don't you mind I do it in a separate patch?

ok for me to do that in separate patch

@vladimirlaz
Copy link
Contributor

@DenisBakhvalov could you please put this change on hold until question below is resolved?

@bader I see that in SYCL 2020 spec there is no requirement for info::platform::version format (major_number.minor_number).
It stays only for device. Do we really need to apply this change? We can stay with the version format returned by BE to avoid confusion.

leftPos++;

auto rightPos = result.find(' ', dotPos);
return result.substr(leftPos, rightPos - leftPos);
Copy link
Contributor

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).

@bader bader changed the title [SYCL] - Align get_info<info::device::version>() with the SYCL spec [SYCL] Align get_info<info::device::version>() with the SYCL spec Sep 24, 2020
@bader
Copy link
Contributor

bader commented Sep 24, 2020

@DenisBakhvalov could you please put this change on hold until question below is resolved?

@bader I see that in SYCL 2020 spec there is no requirement for info::platform::version format (major_number.minor_number).
It stays only for device. Do we really need to apply this change? We can stay with the version format returned by BE to avoid confusion.

Good question. @intel/dpcpp-specification-reviewers, what do you think?

@DenisBakhvalov
Copy link
Contributor Author

pinging @intel/dpcpp-specification-reviewers.

@dm-vodopyanov
Copy link
Contributor

@jbrodman, @mkinsner, could you please answer the question above?

@DenisBakhvalov
Copy link
Contributor Author

@jbrodman, @mkinsner, could you please answer the question above?

@jbrodman, @mkinsner, ping

@bader
Copy link
Contributor

bader commented Oct 12, 2020

@vladimirlaz, SYCL-2020 defines info::platform::version as Returns the software driver version of the device., w/o restricting string format. I think we can keep the patch limited to info::device::version only.

@bader bader merged commit 4644e63 into intel:sycl Oct 12, 2020
alexbatashev pushed a commit to alexbatashev/llvm that referenced this pull request Oct 14, 2020
* sycl: (566 commits)
  [SYCL] Fix explicit copy operation for host device (intel#2627)
  [SYCL] Fix initialization issue on Windows (intel#2632)
  [SYCL][CUDA] Disable image_write test on CUDA devices (intel#2630)
  [SYCL] Removes any knowledge of specific memory advices from PI API. (intel#2607)
  [BuildBot] Uplift GPU RT version for Linux to 20.40.18075 (intel#2626)
  [SYCL] Wrap complex global objects to control lifetime (intel#2516)
  [SYCL][CUDA] Image Basic Test (intel#1970)
  [SYCL] Align get_info<info::device::version>() with the SYCL spec (intel#2507)
  [Driver][SYCL] Correct optimization disabling option for gen (intel#2622)
  [SYCL][LIT] Add deleter func for test in buffer.cpp to avoid potential SegFault (intel#2616)
  [SYCL] Remove half type alias causing name conflicts (intel#2624)
  [BuildBot] OpenCL CPU/FPGAEMU driver uplift (intel#2620)
  [SYCL][Doc] Add overview of kernel-program caching (intel#2514)
  [SYCL] Remove two-input sub-group shuffles (intel#2614)
  [SYCL] Add support for new spelling of FPGA kernel attribute scheduler_target_fmax_mhz (intel#2618)
  [SYCL] Align image class constructors with the SYCL spec (intel#2603)
  [SYCL] Remove tests migrated to llvm-test-suite (intel#2611)
  [SYCL][NFC] Fix dependency for SYCL add_sycl_executable macro (intel#2613)
  [SYCL][PI][L0] Update environment variables from LEVEL0 to LEVEL_ZERO (intel#2612)
  [SYCL] Add KernelNameTypeVisitor validation check (intel#2596)
  ...
iclsrc pushed a commit that referenced this pull request Apr 25, 2024
-This reduces the number of required type casts.-
This unifies all the version methods used in translator.

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@a3d840ec247c5cb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants