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

[#60][feat] Support barrier with memory scope parameter #63

Merged
merged 2 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/BuiltinsRISCV.def
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
//===----------------------------------------------------------------------===//

// Barrier function builtins
TARGET_BUILTIN(barrier, "vi", "n", "32bit")
TARGET_BUILTIN(barrier, "vi.", "n", "32bit")
TARGET_BUILTIN(work_group_barrier, "vi.", "n", "32bit")
// WORKAROUND: Disabled for now.
/*
Expand Down
2 changes: 0 additions & 2 deletions clang/lib/CodeGen/CGBuiltin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19491,8 +19491,6 @@ Value *CodeGenFunction::EmitRISCVBuiltinExpr(unsigned BuiltinID,

// Ventus GPGPU workitem
case RISCV::BIbarrier:
ID = Intrinsic::riscv_ventus_barrier;
break;
case RISCV::BIwork_group_barrier: {
unsigned NumArgs = E->getNumArgs();
switch (NumArgs) {
Expand Down
12 changes: 12 additions & 0 deletions clang/test/CodeGenOpenCL/barrier.cl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// RUN: clang -no-opaque-pointers -triple riscv32-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s

void test() {
// CHECK: call void @llvm.riscv.ventus.barrier(i32 1)
// CHECK-NEXT: call void @llvm.riscv.ventus.barrier.with.scope(i32 1, i32 2)
// CHECK-NEXT: call void @llvm.riscv.ventus.barrier(i32 1)
// CHECK-NEXT: call void @llvm.riscv.ventus.barrier.with.scope(i32 1, i32 2)
barrier(1);
barrier(1, 2);
work_group_barrier(1);
work_group_barrier(1, 2);
}