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][Fusion][NoSTL] Reimplement Indices class without std::array #12340

Merged
merged 9 commits into from
Jan 12, 2024

Conversation

jopperm
Copy link
Contributor

@jopperm jopperm commented Jan 10, 2024

The jit_compiler::NDRange class stores global/local sizes and an offset as instances of jit_compiler::Indices, which previously was just an alias to std::array<size_t, 3>. To elide this use of the STL class, I implemented a drop-in replacement which is backed by a C array and provides a minimal set of accessors and operators.

This PR is part of a series of changes to remove uses of STL classes in the kernel fusion interface to prevent ABI issues in the future.

…d::array`.

Signed-off-by: Julian Oppermann <julian.oppermann@codeplay.com>
@jopperm jopperm self-assigned this Jan 10, 2024
@jopperm jopperm requested a review from a team as a code owner January 10, 2024 01:06
Signed-off-by: Julian Oppermann <julian.oppermann@codeplay.com>
Copy link
Contributor

@sommerlukas sommerlukas left a comment

Choose a reason for hiding this comment

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

Just nits.

sycl-fusion/passes/kernel-fusion/SYCLKernelFusion.cpp Outdated Show resolved Hide resolved
@@ -92,7 +92,7 @@ Expected<std::unique_ptr<Module>> helper::FusionHelper::addFusedKernel(
{
const auto MDFromND = [&LLVMCtx](const auto &ND) {
auto MDFromIndices = [&LLVMCtx](const auto &Ind) -> Metadata * {
std::array<Metadata *, jit_compiler::Indices{}.size()> MD{nullptr};
std::array<Metadata *, 3> MD{nullptr};
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add a static constexpr function to Indices, so we do not have to use the magic number 3, but instead can use Indices::size()?

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
std::array<Metadata *, 3> MD{nullptr};
std::array<Metadata *, jit_compiler::Indices::size()> MD{nullptr};

sycl-fusion/common/include/Kernel.h Outdated Show resolved Hide resolved
sycl-fusion/common/lib/Kernel.cpp Outdated Show resolved Hide resolved
Signed-off-by: Julian Oppermann <julian.oppermann@codeplay.com>
Signed-off-by: Julian Oppermann <julian.oppermann@codeplay.com>
Signed-off-by: Julian Oppermann <julian.oppermann@codeplay.com>
Signed-off-by: Julian Oppermann <julian.oppermann@codeplay.com>
sycl-fusion/common/include/Kernel.h Outdated Show resolved Hide resolved
@@ -92,7 +92,7 @@ Expected<std::unique_ptr<Module>> helper::FusionHelper::addFusedKernel(
{
const auto MDFromND = [&LLVMCtx](const auto &ND) {
auto MDFromIndices = [&LLVMCtx](const auto &Ind) -> Metadata * {
std::array<Metadata *, jit_compiler::Indices{}.size()> MD{nullptr};
std::array<Metadata *, 3> MD{nullptr};
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
std::array<Metadata *, 3> MD{nullptr};
std::array<Metadata *, jit_compiler::Indices::size()> MD{nullptr};

… with it.

Signed-off-by: Julian Oppermann <julian.oppermann@codeplay.com>
Signed-off-by: Julian Oppermann <julian.oppermann@codeplay.com>
Signed-off-by: Julian Oppermann <julian.oppermann@codeplay.com>
@againull againull merged commit b788a3f into intel:sycl Jan 12, 2024
11 checks passed
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