-
Notifications
You must be signed in to change notification settings - Fork 755
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] Support for load/store cache controls #11584
Conversation
sycl/doc/extensions/proposed/sycl_ext_intel_cache_controls.asciidoc
Outdated
Show resolved
Hide resolved
streaming, | ||
invalidate_after_read, | ||
const_cached | ||
const_cached, |
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.
What is the value of adding a coma here?
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.
No real value. Can be removed. Some enums in the compiler tend to use dangling commas.
/// Builds a metadata node for a SPIR-V decoration for cache controls | ||
/// where decoration code and value are both uint32_t integers. | ||
/// The value encodes a cache level and a cache control type. |
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.
Is there a design document or specifications for LLVM/SPIR-V levels?
Cache controls are using annotated pointer design. Right?
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 SPIR-V extension is here: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_cache_controls.asciidoc
This implementation builds upon annotated_ptr by adding new properties.
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.
Thanks. I also find KhronosGroup/SPIRV-LLVM-Translator#2140, which documents the LLVM IR representation of cache controls.
Is this related to #11597 (prefetch hints) in any way? Thanks |
/// where decoration code and value are both uint32_t integers. | ||
/// The value encodes a cache level and a cache control type. | ||
/// | ||
/// @param Ctx [in] the LLVM Context. |
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 comment does not seem to match the signature. Can you pls check? Thanks
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.
Fixed.
streaming = 3 | ||
}; | ||
uint32_t CacheProp; | ||
if (Name == "sycl-cache-read-uncached") |
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.
May be use StringSwitch here?
cached, | ||
streaming, | ||
invalidate, | ||
const_cached, |
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.
How about:
const_cached, | |
constant |
cache_mode::const_cached
has some redundancy compared to cache_mode::constant
.
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
through, | ||
back |
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'd prefer:
through, | |
back | |
write_through, | |
write_back |
I think including "write" in the name here would help readability. These are established terms for how caches work, whereas "through" and "back" by themselves are not. Including "write" in the name here also makes it clear that passing these two modes through to read_hint
will give an error.
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.
These are not user-visible, but I'll make the change you suggest.
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.
LGTM
sycl/include/sycl/ext/intel/experimental/cache_control_properties.hpp
Outdated
Show resolved
Hide resolved
sycl/doc/extensions/proposed/sycl_ext_intel_cache_controls.asciidoc
Outdated
Show resolved
Hide resolved
sycl/doc/extensions/proposed/sycl_ext_intel_cache_controls.asciidoc
Outdated
Show resolved
Hide resolved
sycl/doc/extensions/proposed/sycl_ext_intel_cache_controls.asciidoc
Outdated
Show resolved
Hide resolved
sycl/doc/extensions/proposed/sycl_ext_intel_cache_controls.asciidoc
Outdated
Show resolved
Hide resolved
write_back = 2, | ||
write_streaming = 3 | ||
}; | ||
// SYCL encodings of read/write control |
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.
Please, add a warning that definition of cache_mode
enum must match the definition from sycl/include/sycl/ext/intel/experimental/cache_control_properties.hpp.
Ideally, we should have a single definition across all source files.
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, done
namespace intel { | ||
namespace experimental { | ||
|
||
enum class cache_mode { |
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.
Please, add a warning that definition of cache_mode
enum must match the definition from llvm/lib/SYCLLowerIR/CompileTimePropertiesPass.cpp.
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, done.
…iidoc Co-authored-by: Alexey Bader <[email protected]>
…iidoc Co-authored-by: Alexey Bader <[email protected]>
…iidoc Co-authored-by: Alexey Bader <[email protected]>
…iidoc Co-authored-by: Alexey Bader <[email protected]>
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.
CompileTimePropertiesPass changes as well as the result IR in the test seems legit
This change adds SYCL language support for load store cache controls using SPIR-V ops.