Skip to content

[SYCL] Add specialization constant feature design doc. #2572

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 7 commits into from
Oct 5, 2020

Conversation

kbobrovs
Copy link
Contributor

The document describes design of existing spec constants implementation for primitive types, and proposed design for POD types support.

Signed-off-by: Konstantin S Bobrovsky [email protected]

Copy link
Contributor

@pvchupin pvchupin left a comment

Choose a reason for hiding this comment

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

Formatting/visualization comments inlined

kbobrovs and others added 2 commits October 1, 2020 03:40
Signed-off-by: Konstantin S Bobrovsky <[email protected]>
@kbobrovs kbobrovs requested a review from pvchupin October 1, 2020 13:07
@kbobrovs
Copy link
Contributor Author

kbobrovs commented Oct 1, 2020

@AlexeySotkin , ping

%gold_POD = call %struct.POD __spirvCompositeSpecConstant<POD mangling>(10, 11, 12, 13, 14, 15)
```

where `__spirvCompositeSpecConstant<type mangling>` is a new SPIR-V intrinsic which
Copy link
Contributor

Choose a reason for hiding this comment

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

There are at least 3 different ways to denote mangling of the POD type in this document. I believe they all mean the same thing, can we have single representation for it?

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

the primitive spec constants.
- Then the translator will handle `__spirvCompositeSpecConstant*` intrinsic. It will
recursively traverse the spec constant type structure in parallel with the argument
list - which is a list of primitive spec constant operation IDs (not their SpecIds!).
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a bit confused. What is the argument list? Is it the argument list of __spirvCompositeSpecConstant*? But the example above says that it is a list of SpecId indeed. Having SpecIds here looks logical to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch - will change. It should be SpecIDs of course

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is the SPIRV OpSpecConstantComposite operation, where arguments (operands) are spec constant result IDs rather than SpecIDs

kbobrovs and others added 2 commits October 2, 2020 01:24
Signed-off-by: Konstantin S Bobrovsky <[email protected]>
@kbobrovs kbobrovs requested a review from AlexeySotkin October 2, 2020 08:32
With AOT everything is simplified - the `SpecConstants` pass simply replaces
the `__sycl_getSpecConstantValue` calls with constants - default values of
the spec constant's type. No maps are generated, and SYCL program can't change
the value of a spec constant.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it makes sense to mention what happens if we try to change value of the spec constant in AOT mode. I guess an exception is thrown in this case, right?

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. But this is spec, I don't think we need to duplicate it here.

And 1 "composite"

```cpp
%gold_POD = call %struct.POD __spirvCompositeSpecConstant<POD type mangling>(i32 10, i32 11, i32 12, i32 13, i32 14, i32 15)
Copy link
Contributor

Choose a reason for hiding this comment

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

What is 15 here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

a typo, will remove

@kbobrovs kbobrovs requested a review from AlexeySotkin October 2, 2020 12:15
@kbobrovs kbobrovs requested a review from AlexeySotkin October 2, 2020 13:11
@pvchupin
Copy link
Contributor

pvchupin commented Oct 2, 2020

@AlexeySotkin please have a one more look before merge. I believe comments addressed? Pls. confirm.

@bader bader merged commit 15cac43 into intel:sycl Oct 5, 2020
alexbatashev pushed a commit to alexbatashev/llvm that referenced this pull request Oct 7, 2020
* sycl:
  [SYCL] Fix test failure due to size discrepancy in 32 and 64 bit environment (intel#2594)
  [BuildBot] Linux GPU driver uplift to 20.39.17972 (intel#2600)
  [SYCL][NFC] Remove cyclic dependency in headers (intel#2601)
  [SYCL][Doc] Fix Sphinx docs index (intel#2599)
  [SYCL][PI][L0] Add an assert to piEnqueueKernelLaunch() when the GlobalWorkOffset!=0 (intel#2593)
  [SYCL][Driver] Turn on -spirv-allow-extra-diexpressions option (intel#2578)
  [SYCL] Serialize queue related PI API in the Level-Zero plugin (intel#2588)
  Added missing math APIs for devicelib. (intel#2558)
  [SYCL][DOC] Fix path to FPGA device selector (intel#2563)
  [SYCL][CUDA] Add basic sub-group functionality (intel#2587)
  [SYCL] Add specialization constant feature design doc. (intel#2572)
  [SYCL] Expand release lit test to CPU and ACC (intel#2589)
  [SYCL] Add clang support for FPGA kernel attribute scheduler_target_fmax_mhz (intel#2511)
  [SYCL][ESIMD] Fixed compiler crash in LowerESIMDVecArg pass (intel#2556)
@kbobrovs kbobrovs deleted the spec-const-doc branch January 19, 2022 22:51
kbenzie pushed a commit to kbenzie/intel-llvm that referenced this pull request Feb 17, 2025
Chenyang-L pushed a commit that referenced this pull request Feb 18, 2025
update GitHub Cache action to 4.2.0
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