Skip to content

Commit ad0dd36

Browse files
authored
[SYCL][FPGA] Rename [[intel::disable_loop_pipelining]] attribute function metadata (#11372)
Metadata emitted from front-end when an FPGA IPA kernel has the property pipelined<N> is a function metadata of the form !disable_loop_pipelining !X, !X = !{i32 0|1}. This is confusing as the user means to pipeline the kernel/not pipeline the kernel as opposed to enabling/disabling the pipelining of all loops in the kernel/function, and this name does not reflect that. This patch renames the function metadata to "!pipeline_kernel", and to flip the argument. We believe it may convey information better about what to do with the kernel when the property is absent. This was likely caused by a miscommunication with the related loop metadata that's currently being attached when the loop attribute [[intel::disable_loop_pipelining]] is used: {!"llvm.loop.intel.pipelining.enable", i32 0} --------- Signed-off-by: Soumi Manna <soumi.manna@intel.com>
1 parent f653f35 commit ad0dd36

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

clang/include/clang/Basic/AttrDocs.td

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3361,11 +3361,10 @@ def SYCLIntelDisableLoopPipeliningAttrDocs : Documentation {
33613361
let Heading = "intel::disable_loop_pipelining";
33623362
let Content = [{
33633363
This attribute applies to a loop or a function. Takes no arguments and
3364-
disables pipelining of the loop or function data path, causing the loop
3365-
or function to be executed serially. Cannot be used on the same loop or
3366-
function, or in conjunction with ``speculated_iterations``, ``max_concurrency``,
3367-
``initiation_interval``, ``ivdep``, ``max_reinvocation_delay`` or
3368-
``enable_loop_pipelining`` attribute.
3364+
indicates whether the kernel should be pipelined or not. Cannot be used on the
3365+
same loop or function, or in conjunction with ``speculated_iterations``,
3366+
``max_concurrency``, ``initiation_interval``, ``ivdep``,
3367+
``max_reinvocation_delay`` or ``enable_loop_pipelining`` attribute.
33693368

33703369
.. code-block:: c++
33713370

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -789,9 +789,8 @@ void CodeGenFunction::EmitKernelMetadata(const FunctionDecl *FD,
789789

790790
if (FD->hasAttr<SYCLIntelDisableLoopPipeliningAttr>()) {
791791
llvm::Metadata *AttrMDArgs[] = {
792-
llvm::ConstantAsMetadata::get(Builder.getInt32(1))};
793-
Fn->setMetadata("disable_loop_pipelining",
794-
llvm::MDNode::get(Context, AttrMDArgs));
792+
llvm::ConstantAsMetadata::get(Builder.getInt32(0))};
793+
Fn->setMetadata("pipeline_kernel", llvm::MDNode::get(Context, AttrMDArgs));
795794
}
796795

797796
if (const auto *A = FD->getAttr<SYCLIntelInitiationIntervalAttr>()) {

clang/test/CodeGenSYCL/disable_loop_pipelining.cpp renamed to clang/test/CodeGenSYCL/pipeline_kernel.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ int main() {
2929
return 0;
3030
}
3131

32-
// CHECK: define dso_local spir_kernel void @{{.*}}test_kernel1() #0 {{.*}} !disable_loop_pipelining ![[NUM5:[0-9]+]]
32+
// CHECK: define dso_local spir_kernel void @{{.*}}test_kernel1() #0 {{.*}} !pipeline_kernel ![[NUM5:[0-9]+]]
3333
// CHECK: define dso_local spir_kernel void @{{.*}}test_kernel2() #0 {{.*}} ![[NUM4:[0-9]+]]
34-
// CHECK: define dso_local spir_kernel void @{{.*}}test_kernel3() #0 {{.*}} !disable_loop_pipelining ![[NUM5]]
34+
// CHECK: define dso_local spir_kernel void @{{.*}}test_kernel3() #0 {{.*}} !pipeline_kernel ![[NUM5]]
3535
// CHECK: ![[NUM4]] = !{}
36-
// CHECK: ![[NUM5]] = !{i32 1}
36+
// CHECK: ![[NUM5]] = !{i32 0}

0 commit comments

Comments
 (0)