-
Notifications
You must be signed in to change notification settings - Fork 224
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
Implement SPV_INTEL_global_variable_decorations extension #1389
Conversation
This change adds support of decorations applied to global variables through `spirv.Decorations` metadata in LLVM IR. These decorations are mostly intended to help code generation for FPGA devices: * HostAccessINTEL * InitModeINTEL * ImplementInCSRINTEL Spec: https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/DeviceGlobal/SPV_INTEL_global_variable_decorations.asciidoc
Tagging @AlexeySotkin @MrSidims @KornevNikita @pauzinl to take a look |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good for me
lib/SPIRV/SPIRVWriter.cpp
Outdated
assert(NumOperands == 3 && | ||
"HostAccessINTEL requires exactly 3 extra operand"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to spec, there are 2 operands.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, here's a bit incorrect naming/numbering of operands - it actually means that we expect metadata to contain 3 operands like !{i32 6147, i32 0, !{"Name"}}
, where the decoration itself contains exactly 2 operands.
It was done alike to DecorationLinkageAttributes handling (see above).
I suppose the warning in the assert should be changed to avoid confusion.
; CHECK-LLVM: @int_var = addrspace(1) global i32 42 | ||
; CHECK-LLVM: @float_var = addrspace(1) global float 1.000000e+00 | ||
; CHECK-LLVM: @bool_var = addrspace(1) global i1 false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, that's interesting result. What would be 'OpenCL' IR representation of this feature? May be this comment should be applied sooner vs later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it would be the same as for default behavior (IR as in CHECK-LLVM).
What is expected for the output of SPIRVToOCL
pass? Should we just drop the decorations or to transform them to global variable attributes like attributes #0 = {"init_mode"="0" "host_access"="1"}
? Or maybe something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO, I'd expect we do drop the metadata in OpenCL IR mode until we have OpenCL extension for this feature. When/if we will have the OpenCL extension, we will have it's representation in OpenCL C and clang will translate it into something in LLVM IR. And that LLVM IR representation, I think, should be generated as output of SPIRVToOCL
pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like we have one. However it doesn't define OpenCL C representation. Probably it is not final draft.
FYI to @steffenlarsen since you were working in this area of the SPIRV-LLVM translator also. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…up#1389) * Implement SPV_INTEL_global_variable_decorations extension This change adds support of decorations applied to global variables through `spirv.Decorations` metadata in LLVM IR. These decorations are mostly intended to help code generation for FPGA devices: * HostAccessINTEL * InitModeINTEL * ImplementInCSRINTEL Spec: https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/DeviceGlobal/SPV_INTEL_global_variable_decorations.asciidoc
…ons extension .. '"master"' -> '"xmain-web"' (1 commits) CONFLICT (content): Merge conflict in lib/SPIRV/libSPIRV/spirv_internal.hpp CONFLICT (content): Merge conflict in lib/SPIRV/libSPIRV/SPIRVNameMapEnum.h CONFLICT (content): Merge conflict in lib/SPIRV/libSPIRV/SPIRVDecorate.cpp CONFLICT (content): Merge conflict in include/LLVMSPIRVExtensions.inc commit 8937ecf Author: Viktoria Maximova <[email protected]> Date: Thu Feb 3 17:53:08 2022 +0300 Implement SPV_INTEL_global_variable_decorations extension (KhronosGroup#1389) * Implement SPV_INTEL_global_variable_decorations extension This change adds support of decorations applied to global variables through `spirv.Decorations` metadata in LLVM IR. These decorations are mostly intended to help code generation for FPGA devices: * HostAccessINTEL * InitModeINTEL * ImplementInCSRINTEL Spec: https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/DeviceGlobal/SPV_INTEL_global_variable_decorations.asciidoc
…le_decorations extension .. '"master"' -> '"xmain-web"' (1 commits) (KhronosGroup#117) * Resolve of merge (conflict) 8937ecf Implement SPV_INTEL_global_variable_decorations extension .. '"master"' -> '"xmain-web"' (1 commits) CONFLICT (content): Merge conflict in lib/SPIRV/libSPIRV/spirv_internal.hpp CONFLICT (content): Merge conflict in lib/SPIRV/libSPIRV/SPIRVNameMapEnum.h CONFLICT (content): Merge conflict in lib/SPIRV/libSPIRV/SPIRVDecorate.cpp CONFLICT (content): Merge conflict in include/LLVMSPIRVExtensions.inc commit 8937ecf Author: Viktoria Maximova <[email protected]> Date: Thu Feb 3 17:53:08 2022 +0300 Implement SPV_INTEL_global_variable_decorations extension (KhronosGroup#1389) * Implement SPV_INTEL_global_variable_decorations extension This change adds support of decorations applied to global variables through `spirv.Decorations` metadata in LLVM IR. These decorations are mostly intended to help code generation for FPGA devices: * HostAccessINTEL * InitModeINTEL * ImplementInCSRINTEL Spec: https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/DeviceGlobal/SPV_INTEL_global_variable_decorations.asciidoc * Resolve conflicts Co-authored-by: iclsrc <[email protected]> Co-authored-by: Sergey Semenov <[email protected]>
…al_variable_decorations extension .. '"master"' -> '"xmain-web"' (1 commits) (KhronosGroup#117) * Resolve of merge (conflict) 8937ecf Implement SPV_INTEL_global_variable_decorations extension .. '"master"' -> '"xmain-web"' (1 commits) CONFLICT (content): Merge conflict in lib/SPIRV/libSPIRV/spirv_internal.hpp CONFLICT (content): Merge conflict in lib/SPIRV/libSPIRV/SPIRVNameMapEnum.h CONFLICT (content): Merge conflict in lib/SPIRV/libSPIRV/SPIRVDecorate.cpp CONFLICT (content): Merge conflict in include/LLVMSPIRVExtensions.inc commit 8937ecf Author: Viktoria Maximova <[email protected]> Date: Thu Feb 3 17:53:08 2022 +0300 Implement SPV_INTEL_global_variable_decorations extension (KhronosGroup#1389) * Implement SPV_INTEL_global_variable_decorations extension This change adds support of decorations applied to global variables through `spirv.Decorations` metadata in LLVM IR. These decorations are mostly intended to help code generation for FPGA devices: * HostAccessINTEL * InitModeINTEL * ImplementInCSRINTEL Spec: https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/DeviceGlobal/SPV_INTEL_global_variable_decorations.asciidoc * Resolve conflicts Co-authored-by: iclsrc <[email protected]> Co-authored-by: Sergey Semenov <[email protected]>
…nsion (KhronosGroup#1389) * Implement SPV_INTEL_global_variable_decorations extension This change adds support of decorations applied to global variables through `spirv.Decorations` metadata in LLVM IR. These decorations are mostly intended to help code generation for FPGA devices: * HostAccessINTEL * InitModeINTEL * ImplementInCSRINTEL Spec: https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/DeviceGlobal/SPV_INTEL_global_variable_decorations.asciidoc
…nsion (KhronosGroup#1389) * Implement SPV_INTEL_global_variable_decorations extension This change adds support of decorations applied to global variables through `spirv.Decorations` metadata in LLVM IR. These decorations are mostly intended to help code generation for FPGA devices: * HostAccessINTEL * InitModeINTEL * ImplementInCSRINTEL Spec: https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/DeviceGlobal/SPV_INTEL_global_variable_decorations.asciidoc
…sion (KhronosGroup#1389) * Implement SPV_INTEL_global_variable_decorations extension This change adds support of decorations applied to global variables through `spirv.Decorations` metadata in LLVM IR. These decorations are mostly intended to help code generation for FPGA devices: * HostAccessINTEL * InitModeINTEL * ImplementInCSRINTEL Spec: https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/DeviceGlobal/SPV_INTEL_global_variable_decorations.asciidoc
…sion (KhronosGroup#1389) * Implement SPV_INTEL_global_variable_decorations extension This change adds support of decorations applied to global variables through `spirv.Decorations` metadata in LLVM IR. These decorations are mostly intended to help code generation for FPGA devices: * HostAccessINTEL * InitModeINTEL * ImplementInCSRINTEL Spec: https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/DeviceGlobal/SPV_INTEL_global_variable_decorations.asciidoc
…sion (KhronosGroup#1389) * Implement SPV_INTEL_global_variable_decorations extension This change adds support of decorations applied to global variables through `spirv.Decorations` metadata in LLVM IR. These decorations are mostly intended to help code generation for FPGA devices: * HostAccessINTEL * InitModeINTEL * ImplementInCSRINTEL Spec: https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/DeviceGlobal/SPV_INTEL_global_variable_decorations.asciidoc
…nsion (KhronosGroup#1389) * Implement SPV_INTEL_global_variable_decorations extension This change adds support of decorations applied to global variables through `spirv.Decorations` metadata in LLVM IR. These decorations are mostly intended to help code generation for FPGA devices: * HostAccessINTEL * InitModeINTEL * ImplementInCSRINTEL Spec: https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/DeviceGlobal/SPV_INTEL_global_variable_decorations.asciidoc
…nsion (KhronosGroup#1389) * Implement SPV_INTEL_global_variable_decorations extension This change adds support of decorations applied to global variables through `spirv.Decorations` metadata in LLVM IR. These decorations are mostly intended to help code generation for FPGA devices: * HostAccessINTEL * InitModeINTEL * ImplementInCSRINTEL Spec: https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/DeviceGlobal/SPV_INTEL_global_variable_decorations.asciidoc
…sion (KhronosGroup#1389) * Implement SPV_INTEL_global_variable_decorations extension This change adds support of decorations applied to global variables through `spirv.Decorations` metadata in LLVM IR. These decorations are mostly intended to help code generation for FPGA devices: * HostAccessINTEL * InitModeINTEL * ImplementInCSRINTEL Spec: https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/DeviceGlobal/SPV_INTEL_global_variable_decorations.asciidoc
…nsion (#1389) * Implement SPV_INTEL_global_variable_decorations extension This change adds support of decorations applied to global variables through `spirv.Decorations` metadata in LLVM IR. These decorations are mostly intended to help code generation for FPGA devices: * HostAccessINTEL * InitModeINTEL * ImplementInCSRINTEL Spec: https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/DeviceGlobal/SPV_INTEL_global_variable_decorations.asciidoc
…sion (#1389) * Implement SPV_INTEL_global_variable_decorations extension This change adds support of decorations applied to global variables through `spirv.Decorations` metadata in LLVM IR. These decorations are mostly intended to help code generation for FPGA devices: * HostAccessINTEL * InitModeINTEL * ImplementInCSRINTEL Spec: https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/DeviceGlobal/SPV_INTEL_global_variable_decorations.asciidoc
…nsion (KhronosGroup#1389) * Implement SPV_INTEL_global_variable_decorations extension This change adds support of decorations applied to global variables through `spirv.Decorations` metadata in LLVM IR. These decorations are mostly intended to help code generation for FPGA devices: * HostAccessINTEL * InitModeINTEL * ImplementInCSRINTEL Spec: https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/DeviceGlobal/SPV_INTEL_global_variable_decorations.asciidoc
…nsion (#1389) * Implement SPV_INTEL_global_variable_decorations extension This change adds support of decorations applied to global variables through `spirv.Decorations` metadata in LLVM IR. These decorations are mostly intended to help code generation for FPGA devices: * HostAccessINTEL * InitModeINTEL * ImplementInCSRINTEL Spec: https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/DeviceGlobal/SPV_INTEL_global_variable_decorations.asciidoc
This change is basically an update of KhronosGroup#1389 for spec changes. Implementation of the feature was based on Intel extension which was not officially published to Khronos. Now it has been split, updated, and published to Khronos by KhronosGroup/SPIRV-Registry#205 Summary of the things that have changed: * Capability names and a new capability was added * Values for decorations have been updated to enums * Decoration names and IDs have been changed Specs: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_fpga_decorations.asciidoc https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_host_access.asciidoc
This change is basically an update of KhronosGroup#1389 for spec changes. Implementation of the feature was based on Intel extension which was not officially published to Khronos. Now it has been split, updated, and published to Khronos by KhronosGroup/SPIRV-Registry#205 Summary of the things that have changed: * Capability names and a new capability was added * Values for decorations have been updated to enums * Decoration names and IDs have been changed Specs: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_fpga_decorations.asciidoc https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_host_access.asciidoc
This change is basically an update of #1389 for spec changes. Implementation of the feature was based on Intel extension which was not officially published to Khronos. Now it has been split, updated, and published to Khronos by KhronosGroup/SPIRV-Registry#205 Summary of the things that have changed: Capability names and a new capability was added Values for decorations have been updated to enums Decoration names and IDs have been changed Specs: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_fpga_decorations.asciidoc https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_host_access.asciidoc
…p#2174) This change is basically an update of KhronosGroup#1389 for spec changes. Implementation of the feature was based on Intel extension which was not officially published to Khronos. Now it has been split, updated, and published to Khronos by KhronosGroup/SPIRV-Registry#205 Summary of the things that have changed: Capability names and a new capability was added Values for decorations have been updated to enums Decoration names and IDs have been changed Specs: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_fpga_decorations.asciidoc https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_host_access.asciidoc
…p#2174) This change is basically an update of KhronosGroup#1389 for spec changes. Implementation of the feature was based on Intel extension which was not officially published to Khronos. Now it has been split, updated, and published to Khronos by KhronosGroup/SPIRV-Registry#205 Summary of the things that have changed: Capability names and a new capability was added Values for decorations have been updated to enums Decoration names and IDs have been changed Specs: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_fpga_decorations.asciidoc https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_host_access.asciidoc
…p#2174) This change is basically an update of KhronosGroup#1389 for spec changes. Implementation of the feature was based on Intel extension which was not officially published to Khronos. Now it has been split, updated, and published to Khronos by KhronosGroup/SPIRV-Registry#205 Summary of the things that have changed: Capability names and a new capability was added Values for decorations have been updated to enums Decoration names and IDs have been changed Specs: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_fpga_decorations.asciidoc https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_host_access.asciidoc
…p#2174) This change is basically an update of KhronosGroup#1389 for spec changes. Implementation of the feature was based on Intel extension which was not officially published to Khronos. Now it has been split, updated, and published to Khronos by KhronosGroup/SPIRV-Registry#205 Summary of the things that have changed: Capability names and a new capability was added Values for decorations have been updated to enums Decoration names and IDs have been changed Specs: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_fpga_decorations.asciidoc https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_host_access.asciidoc
…p#2174) This change is basically an update of KhronosGroup#1389 for spec changes. Implementation of the feature was based on Intel extension which was not officially published to Khronos. Now it has been split, updated, and published to Khronos by KhronosGroup/SPIRV-Registry#205 Summary of the things that have changed: Capability names and a new capability was added Values for decorations have been updated to enums Decoration names and IDs have been changed Specs: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_fpga_decorations.asciidoc https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_host_access.asciidoc
This change is basically an update of #1389 for spec changes. Implementation of the feature was based on Intel extension which was not officially published to Khronos. Now it has been split, updated, and published to Khronos by KhronosGroup/SPIRV-Registry#205 Summary of the things that have changed: Capability names and a new capability was added Values for decorations have been updated to enums Decoration names and IDs have been changed Specs: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_fpga_decorations.asciidoc https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_host_access.asciidoc Co-authored-by: Viktoria Maximova <[email protected]>
This change is basically an update of #1389 for spec changes. Implementation of the feature was based on Intel extension which was not officially published to Khronos. Now it has been split, updated, and published to Khronos by KhronosGroup/SPIRV-Registry#205 Summary of the things that have changed: Capability names and a new capability was added Values for decorations have been updated to enums Decoration names and IDs have been changed Specs: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_fpga_decorations.asciidoc https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_host_access.asciidoc Co-authored-by: Viktoria Maximova <[email protected]>
This change is basically an update of #1389 for spec changes. Implementation of the feature was based on Intel extension which was not officially published to Khronos. Now it has been split, updated, and published to Khronos by KhronosGroup/SPIRV-Registry#205 Summary of the things that have changed: Capability names and a new capability was added Values for decorations have been updated to enums Decoration names and IDs have been changed Specs: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_fpga_decorations.asciidoc https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_host_access.asciidoc Co-authored-by: Viktoria Maximova <[email protected]>
This change is basically an update of #1389 for spec changes. Implementation of the feature was based on Intel extension which was not officially published to Khronos. Now it has been split, updated, and published to Khronos by KhronosGroup/SPIRV-Registry#205 Summary of the things that have changed: Capability names and a new capability was added Values for decorations have been updated to enums Decoration names and IDs have been changed Specs: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_fpga_decorations.asciidoc https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_host_access.asciidoc Co-authored-by: Viktoria Maximova <[email protected]>
This change adds support of decorations applied to global variables through
spirv.Decorations
metadata in LLVM IR.These decorations are mostly intended to help code generation for FPGA devices:
Spec:
https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/DeviceGlobal/SPV_INTEL_global_variable_decorations.asciidoc