Skip to content

Commit

Permalink
Correctly handle linkage qualifiers for dpcpp device functions. (libo…
Browse files Browse the repository at this point in the history
  • Loading branch information
kris-rowe committed Sep 12, 2023
1 parent a9e9ddd commit 4638408
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/cpp/30_device_function/addVectors.okl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
float add(const float* a,
static float add(const float* a,
int i,
const float* b,
int j) {
Expand Down
9 changes: 4 additions & 5 deletions src/occa/internal/lang/modes/dpcpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,12 @@ namespace occa
.forEach([&](statement_t *smnt)
{
functionDeclStatement &funcDeclSmnt = (functionDeclStatement &)*smnt;

if (funcDeclSmnt.hasAttribute("kernel"))
{
return;
}
if (funcDeclSmnt.hasAttribute("kernel")) return;

vartype_t &vartype = funcDeclSmnt.function().returnType;
if (vartype.has(occa::lang::static_)) return;

// Only add SYCL_EXTERNAL if we have external linkage
vartype.qualifiers.addFirst(vartype.origin(), device);
});
}
Expand Down

0 comments on commit 4638408

Please sign in to comment.