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

[SYCL][FPGA] Rename [[intel::disable_loop_pipelining]] attribute function metadata #11372

Merged
merged 6 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
9 changes: 4 additions & 5 deletions clang/include/clang/Basic/AttrDocs.td
Original file line number Diff line number Diff line change
Expand Up @@ -3357,11 +3357,10 @@ def SYCLIntelDisableLoopPipeliningAttrDocs : Documentation {
let Heading = "intel::disable_loop_pipelining";
let Content = [{
This attribute applies to a loop or a function. Takes no arguments and
disables pipelining of the loop or function data path, causing the loop
or function to be executed serially. Cannot be used on the same loop or
function, or in conjunction with ``speculated_iterations``, ``max_concurrency``,
``initiation_interval``, ``ivdep``, ``max_reinvocation_delay`` or
``enable_loop_pipelining`` attribute.
indicates that the kernel should be pipelined or not. Cannot be used on the
bowenxue-intel marked this conversation as resolved.
Show resolved Hide resolved
smanna12 marked this conversation as resolved.
Show resolved Hide resolved
same loop or function, or in conjunction with ``speculated_iterations``,
``max_concurrency``, ``initiation_interval``, ``ivdep``,
``max_reinvocation_delay`` or ``enable_loop_pipelining`` attribute.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bowenxue-intel for reviews. We added support for "enable_loop_pipeling" on #9263

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @smanna12 , after talking it over with some of my colleagues, we decided with the knowledge that both [[intel::disable_loop_pipelining]] and [[intel::enable_loop_pipelining]] are currently generating the same metadata, to leave the implementation for that as is in order to be unified in the SPIR-V translation side.

I believe you can revert your changes in this file, CGLoopInfo.cpp, and intel-fpga-loops.cpp

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bowenxue-intel for the update.

I believe you can revert your changes in this file, CGLoopInfo.cpp, and intel-fpga-loops.cpp

Sure. Done


.. code-block:: c++

Expand Down
11 changes: 6 additions & 5 deletions clang/lib/CodeGen/CGLoopInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,11 +575,12 @@ MDNode *LoopInfo::createMetadata(
}

// disable_loop_pipelining attribute corresponds to
// 'llvm.loop.intel.pipelining.enable, i32 0' metadata
// 'llvm.loop.intel.pipelining.disable, i32 1' metadata
if (Attrs.SYCLLoopPipeliningDisable) {
Metadata *Vals[] = {MDString::get(Ctx, "llvm.loop.intel.pipelining.enable"),
ConstantAsMetadata::get(
ConstantInt::get(llvm::Type::getInt32Ty(Ctx), 0))};
Metadata *Vals[] = {
MDString::get(Ctx, "llvm.loop.intel.pipelining.disable"),
ConstantAsMetadata::get(
ConstantInt::get(llvm::Type::getInt32Ty(Ctx), 1))};
LoopProperties.push_back(MDNode::get(Ctx, Vals));
}

Expand Down Expand Up @@ -1026,7 +1027,7 @@ void LoopInfoStack::push(BasicBlock *Header, clang::ASTContext &Ctx,
// without parameter - 'lvm.loop.coalesce.enable' metadata will be emitted
// n - 'llvm.loop.coalesce.count, i32 n' metadata will be emitted
// For attribute disable_loop_pipelining:
// 'llvm.loop.intel.pipelining.enable, i32 0' metadata will be emitted
// 'llvm.loop.intel.pipelining.disable, i32 1' metadata will be emitted
// For attribute max_interleaving:
// n - 'llvm.loop.max_interleaving.count, i32 n' metadata will be emitted
// For attribute speculated_iterations:
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CodeGenFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ void CodeGenFunction::EmitKernelMetadata(const FunctionDecl *FD,
if (FD->hasAttr<SYCLIntelDisableLoopPipeliningAttr>()) {
llvm::Metadata *AttrMDArgs[] = {
llvm::ConstantAsMetadata::get(Builder.getInt32(1))};
Fn->setMetadata("disable_loop_pipelining",
Fn->setMetadata("disable_kernel_pipelining",
llvm::MDNode::get(Context, AttrMDArgs));
}

Expand Down
4 changes: 2 additions & 2 deletions clang/test/CodeGenSYCL/disable_loop_pipelining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ int main() {
return 0;
}

// CHECK: define dso_local spir_kernel void @{{.*}}test_kernel1() #0 {{.*}} !disable_loop_pipelining ![[NUM5:[0-9]+]]
// CHECK: define dso_local spir_kernel void @{{.*}}test_kernel1() #0 {{.*}} !disable_kernel_pipelining ![[NUM5:[0-9]+]]
smanna12 marked this conversation as resolved.
Show resolved Hide resolved
// CHECK: define dso_local spir_kernel void @{{.*}}test_kernel2() #0 {{.*}} ![[NUM4:[0-9]+]]
// CHECK: define dso_local spir_kernel void @{{.*}}test_kernel3() #0 {{.*}} !disable_loop_pipelining ![[NUM5]]
// CHECK: define dso_local spir_kernel void @{{.*}}test_kernel3() #0 {{.*}} !disable_kernel_pipelining ![[NUM5]]
// CHECK: ![[NUM4]] = !{}
// CHECK: ![[NUM5]] = !{i32 1}
2 changes: 1 addition & 1 deletion clang/test/CodeGenSYCL/intel-fpga-loops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void disable_loop_pipelining() {
int a[10];
// CHECK: ![[MD_DLP]] = distinct !{![[MD_DLP]], ![[MP:[0-9]+]], ![[MD_dlp:[0-9]+]]}
// CHECK-NEXT: ![[MP]] = !{!"llvm.loop.mustprogress"}
// CHECK-NEXT: ![[MD_dlp]] = !{!"llvm.loop.intel.pipelining.enable", i32 0}
// CHECK-NEXT: ![[MD_dlp]] = !{!"llvm.loop.intel.pipelining.disable", i32 1}
[[intel::disable_loop_pipelining]] for (int i = 0; i != 10; ++i)
a[i] = 0;
}
Expand Down
Loading