This is an archive of the discontinued LLVM Phabricator instance.

libclc: Make all built-ins overloadable
ClosedPublic

Authored by daniels on Jun 18 2020, 3:12 AM.

Details

Summary

The SPIR spec states that all OpenCL built-in functions should be
overloadable and mangled, to ensure consistency.

Add the overload attribute to functions which were missing them:
work dimensions, memory barriers and fences, and events.

Diff Detail

Event Timeline

daniels created this revision.Jun 18 2020, 3:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 18 2020, 3:12 AM

This fixes things for us running when emitting SPIR-V, as the LLVM -> SPIR-V translator assumes (per the SPIR spec) that all builtins are overloaded and mangled.

The unrelated formatting changes here are from clang-format automatically running under arc.

jenatali accepted this revision.Jun 18 2020, 5:56 AM

Looks good to me. Verified that the async functions now work in SPIR-V with this patch.

This revision is now accepted and ready to land.Jun 18 2020, 5:56 AM

CI failures are due to not ignoring CL source files when running clang-tidy, per previously-submitted PR, as well as an unrelated failure in a clang-go test.

@jvesely @tstellar Hi, any thoughts on this change please? We need this in order to have a fully working SPIR-V backend.

tstellar accepted this revision.Jul 9 2020, 9:06 AM

LGTM.

This revision was automatically updated to reflect the committed changes.