Skip to content

[SYCL] Replace spec constants 2020 with RT-provided values in sycl-post-link #3430

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 5 commits into from
Apr 2, 2021

Conversation

vmaksimo
Copy link
Contributor

By doing this change, SpecConstantsPass starts to replace scalar specialization
constants with a user-provided value from RT (instead of using C++ default
initialization value) for AOT mode.

This is done with the new intrinsic __sycl_getScalar2020SpecConstantValue:
the 3rd argument RTBuffer is a pointer to a runtime buffer, which holds
values of all specialization constants.

…st-link

By doing this change, SpecConstantsPass starts to replace scalar specialization
constants with a user-provided value from RT (instead of using C++ default
initialization value) for AOT mode.

This is done with the new intrinsic __sycl_getScalar2020SpecConstantValue:
the 3rd argument `RTBuffer` is a pointer to a runtime buffer, which holds
values of all specialization constants.
%3 = bitcast %struct._ZTS1A.A* %c.i to i8*
call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %3) #3
call spir_func void @_Z40__sycl_getComposite2020SpecConstantValueI13MyComposConstET_PKcPvS4_(%struct._ZTS1A.A addrspace(4)* sret(%struct._ZTS1A.A) align 4 %c.ascast.i, i8 addrspace(4)* getelementptr inbounds ([20 x i8], [20 x i8] addrspace(4)* addrspacecast ([20 x i8] addrspace(1)* @__builtin_unique_stable_name._ZNK2cl4sycl6ONEAPI12experimental13spec_constantI13MyComposConstE3getIS4_EENSt9enable_ifIXaasr3std8is_classIT_EE5valuesr3std6is_podIS9_EE5valueES9_E4typeEv to [20 x i8] addrspace(4)*), i64 0, i64 0), i8 addrspace(4)* null, i8 addrspace(4)* null) #4
; CHECK: %[[GEP:[0-9a-z]+]] = getelementptr i8, i8 addrspace(4)* null, i32 0
Copy link
Contributor

Choose a reason for hiding this comment

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

This gep from nullptr looks a bit strange, but I guess this is because we pass null to the third argument of the intrinsic. Would be good to somehow change the test so we have a gep from an actual value

@vmaksimo vmaksimo requested a review from AlexeySachkov March 30, 2021 14:50
Copy link
Contributor

@kbobrovs kbobrovs left a comment

Choose a reason for hiding this comment

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

LGTM

@bader bader merged commit 26f1c0a into intel:sycl Apr 2, 2021
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.

5 participants