Skip to content

[sycl-post-link] Add more cases to filter out from entry point check #6874

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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion llvm/tools/sycl-post-link/ModuleSplitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,23 @@ bool isSpirvSyclBuiltin(StringRef FName) {
return FName.startswith("__spirv_") || FName.startswith("__sycl_");
}

// Return true if the function is a ESIMD builtin
// The regexp for ESIMD intrinsics:
// /^_Z(\d+)__esimd_\w+/
bool isESIMDBuiltin(StringRef FName) {
if (!FName.consume_front("_Z"))
return false;
// now skip the digits
FName = FName.drop_while([](char C) { return std::isdigit(C); });

return FName.startswith("__esimd_");
}

// Return true if the function name starts with "__builtin_"
bool isGenericBuiltin(StringRef FName) {
return FName.startswith("__builtin_");
}

bool isKernel(const Function &F) {
return F.getCallingConv() == CallingConv::SPIR_KERNEL;
}
Expand All @@ -128,7 +145,8 @@ bool isEntryPoint(const Function &F, bool EmitOnlyKernelsAsEntryPoints) {
// are also considered as entry points (except __spirv_* and __sycl_*
// functions)
return F.hasFnAttribute(ATTR_SYCL_MODULE_ID) &&
!isSpirvSyclBuiltin(F.getName());
!isSpirvSyclBuiltin(F.getName()) && !isESIMDBuiltin(F.getName()) &&
!isGenericBuiltin(F.getName());
}

return false;
Expand Down