Skip to content

Conversation

@seven-mile
Copy link
Collaborator

Similar to #705, this PR implements the remaining genKernelArgMetadata() logic.

The attribute cir.cl.kernel_arg_metadata is also intentionally placed in the cir.func's extra_attrs rather than cir.func's standard arg_attrs list. Also, the metadata is stored by Array with proper verification on it. See the tablegen doc string for details.

This is in order to

  • keep it side-by-side with cl.kernel_metadata.
  • still emit metadata when kernel has an empty arg list (see the test kernel-arg-meatadata.cl).
  • avoid horrors of repeating the long name cir.cl.kernel_arg_metadata for numArgs times.

Because clangir doesn't support OpenCL built-in types and the half floating point type yet, their changes and test cases are not included. Corresponding missing feature flag is added.

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

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

LGTM. I added some refactoring requirements but feel free to do them in a follow up PR. Thanks!

// for example in clGetKernelArgInfo() implementation between the address
// spaces with targets without unique mapping to the OpenCL address spaces
// (basically all single AS CPUs).
static unsigned ArgInfoAddressSpace(LangAS AS) {
Copy link
Member

Choose a reason for hiding this comment

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

Please add a CIRGenOpenCL.cpp and lets starting put all this specific info over there for implementations. Both of the new functions/methods here qualify.

// OpenCLKernelArgMetadataAttr definitions
//===----------------------------------------------------------------------===//

LogicalResult OpenCLKernelArgMetadataAttr::verify(
Copy link
Member

Choose a reason for hiding this comment

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

Same for these bits, please add a CIROpenCLAttrs.cpp.

@bcardosolopes bcardosolopes merged commit f9f0970 into llvm:main Aug 2, 2024
bcardosolopes pushed a commit that referenced this pull request Aug 8, 2024
…arget (#773)

Similar to #767, this PR emit the module level OpenCL version metadata
following the OG CodeGen skeleton.

We use a full qualified `cir.cl.version` attribute on the module op to
store the info in CIR.
Hugobros3 pushed a commit to shady-gang/clangir that referenced this pull request Oct 2, 2024
Similar to llvm#705, this PR implements the remaining
`genKernelArgMetadata()` logic.

The attribute `cir.cl.kernel_arg_metadata` is also intentionally placed
in the `cir.func`'s `extra_attrs` rather than `cir.func`'s standard
`arg_attrs` list. Also, the metadata is stored by `Array` with proper
verification on it. See the tablegen doc string for details.

This is in order to
* keep it side-by-side with `cl.kernel_metadata`.
* still emit metadata when kernel has an *empty* arg list (see the test
`kernel-arg-meatadata.cl`).
* avoid horrors of repeating the long name `cir.cl.kernel_arg_metadata`
for `numArgs` times.

Because clangir doesn't support OpenCL built-in types and the `half`
floating point type yet, their changes and test cases are not included.
Corresponding missing feature flag is added.
Hugobros3 pushed a commit to shady-gang/clangir that referenced this pull request Oct 2, 2024
…arget (llvm#773)

Similar to llvm#767, this PR emit the module level OpenCL version metadata
following the OG CodeGen skeleton.

We use a full qualified `cir.cl.version` attribute on the module op to
store the info in CIR.
smeenai pushed a commit to smeenai/clangir that referenced this pull request Oct 9, 2024
Similar to llvm#705, this PR implements the remaining
`genKernelArgMetadata()` logic.

The attribute `cir.cl.kernel_arg_metadata` is also intentionally placed
in the `cir.func`'s `extra_attrs` rather than `cir.func`'s standard
`arg_attrs` list. Also, the metadata is stored by `Array` with proper
verification on it. See the tablegen doc string for details.

This is in order to
* keep it side-by-side with `cl.kernel_metadata`.
* still emit metadata when kernel has an *empty* arg list (see the test
`kernel-arg-meatadata.cl`).
* avoid horrors of repeating the long name `cir.cl.kernel_arg_metadata`
for `numArgs` times.

Because clangir doesn't support OpenCL built-in types and the `half`
floating point type yet, their changes and test cases are not included.
Corresponding missing feature flag is added.
smeenai pushed a commit to smeenai/clangir that referenced this pull request Oct 9, 2024
…arget (llvm#773)

Similar to llvm#767, this PR emit the module level OpenCL version metadata
following the OG CodeGen skeleton.

We use a full qualified `cir.cl.version` attribute on the module op to
store the info in CIR.
smeenai pushed a commit to smeenai/clangir that referenced this pull request Oct 9, 2024
Similar to llvm#705, this PR implements the remaining
`genKernelArgMetadata()` logic.

The attribute `cir.cl.kernel_arg_metadata` is also intentionally placed
in the `cir.func`'s `extra_attrs` rather than `cir.func`'s standard
`arg_attrs` list. Also, the metadata is stored by `Array` with proper
verification on it. See the tablegen doc string for details.

This is in order to
* keep it side-by-side with `cl.kernel_metadata`.
* still emit metadata when kernel has an *empty* arg list (see the test
`kernel-arg-meatadata.cl`).
* avoid horrors of repeating the long name `cir.cl.kernel_arg_metadata`
for `numArgs` times.

Because clangir doesn't support OpenCL built-in types and the `half`
floating point type yet, their changes and test cases are not included.
Corresponding missing feature flag is added.
smeenai pushed a commit to smeenai/clangir that referenced this pull request Oct 9, 2024
…arget (llvm#773)

Similar to llvm#767, this PR emit the module level OpenCL version metadata
following the OG CodeGen skeleton.

We use a full qualified `cir.cl.version` attribute on the module op to
store the info in CIR.
keryell pushed a commit to keryell/clangir that referenced this pull request Oct 19, 2024
Similar to llvm#705, this PR implements the remaining
`genKernelArgMetadata()` logic.

The attribute `cir.cl.kernel_arg_metadata` is also intentionally placed
in the `cir.func`'s `extra_attrs` rather than `cir.func`'s standard
`arg_attrs` list. Also, the metadata is stored by `Array` with proper
verification on it. See the tablegen doc string for details.

This is in order to
* keep it side-by-side with `cl.kernel_metadata`.
* still emit metadata when kernel has an *empty* arg list (see the test
`kernel-arg-meatadata.cl`).
* avoid horrors of repeating the long name `cir.cl.kernel_arg_metadata`
for `numArgs` times.

Because clangir doesn't support OpenCL built-in types and the `half`
floating point type yet, their changes and test cases are not included.
Corresponding missing feature flag is added.
keryell pushed a commit to keryell/clangir that referenced this pull request Oct 19, 2024
…arget (llvm#773)

Similar to llvm#767, this PR emit the module level OpenCL version metadata
following the OG CodeGen skeleton.

We use a full qualified `cir.cl.version` attribute on the module op to
store the info in CIR.
lanza pushed a commit that referenced this pull request Nov 5, 2024
Similar to #705, this PR implements the remaining
`genKernelArgMetadata()` logic.

The attribute `cir.cl.kernel_arg_metadata` is also intentionally placed
in the `cir.func`'s `extra_attrs` rather than `cir.func`'s standard
`arg_attrs` list. Also, the metadata is stored by `Array` with proper
verification on it. See the tablegen doc string for details.

This is in order to
* keep it side-by-side with `cl.kernel_metadata`.
* still emit metadata when kernel has an *empty* arg list (see the test
`kernel-arg-meatadata.cl`).
* avoid horrors of repeating the long name `cir.cl.kernel_arg_metadata`
for `numArgs` times.

Because clangir doesn't support OpenCL built-in types and the `half`
floating point type yet, their changes and test cases are not included.
Corresponding missing feature flag is added.
lanza pushed a commit that referenced this pull request Nov 5, 2024
…arget (#773)

Similar to #767, this PR emit the module level OpenCL version metadata
following the OG CodeGen skeleton.

We use a full qualified `cir.cl.version` attribute on the module op to
store the info in CIR.
lanza pushed a commit that referenced this pull request Mar 18, 2025
Similar to #705, this PR implements the remaining
`genKernelArgMetadata()` logic.

The attribute `cir.cl.kernel_arg_metadata` is also intentionally placed
in the `cir.func`'s `extra_attrs` rather than `cir.func`'s standard
`arg_attrs` list. Also, the metadata is stored by `Array` with proper
verification on it. See the tablegen doc string for details.

This is in order to
* keep it side-by-side with `cl.kernel_metadata`.
* still emit metadata when kernel has an *empty* arg list (see the test
`kernel-arg-meatadata.cl`).
* avoid horrors of repeating the long name `cir.cl.kernel_arg_metadata`
for `numArgs` times.

Because clangir doesn't support OpenCL built-in types and the `half`
floating point type yet, their changes and test cases are not included.
Corresponding missing feature flag is added.
lanza pushed a commit that referenced this pull request Mar 18, 2025
…arget (#773)

Similar to #767, this PR emit the module level OpenCL version metadata
following the OG CodeGen skeleton.

We use a full qualified `cir.cl.version` attribute on the module op to
store the info in CIR.
terapines-osc-cir pushed a commit to Terapines/clangir that referenced this pull request Sep 2, 2025
Similar to llvm#705, this PR implements the remaining
`genKernelArgMetadata()` logic.

The attribute `cir.cl.kernel_arg_metadata` is also intentionally placed
in the `cir.func`'s `extra_attrs` rather than `cir.func`'s standard
`arg_attrs` list. Also, the metadata is stored by `Array` with proper
verification on it. See the tablegen doc string for details.

This is in order to
* keep it side-by-side with `cl.kernel_metadata`.
* still emit metadata when kernel has an *empty* arg list (see the test
`kernel-arg-meatadata.cl`).
* avoid horrors of repeating the long name `cir.cl.kernel_arg_metadata`
for `numArgs` times.

Because clangir doesn't support OpenCL built-in types and the `half`
floating point type yet, their changes and test cases are not included.
Corresponding missing feature flag is added.
terapines-osc-cir pushed a commit to Terapines/clangir that referenced this pull request Sep 2, 2025
…arget (llvm#773)

Similar to llvm#767, this PR emit the module level OpenCL version metadata
following the OG CodeGen skeleton.

We use a full qualified `cir.cl.version` attribute on the module op to
store the info in CIR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants