Issue 115912
Summary [DirectX] Update missing attributes in `DXIL.td`
Labels new issue
Assignees inbelic
Reporter inbelic
    `DXIL.td` is missing a lot of attributes for a lot of ops. Many of those available will need to generate meaningful attributes that LLVM recognizes. This includes `IsWave`, `IsBarrier`, `ReadOnly`, `ReadNone`, and `ArgMemOnly`. The others might need to be re-evaluated.

AC:
- [ ] Update `DXIL.td` so that all required attributes are attached to given op
- [ ] Update `DXIL.td` to add/remove any operations
- [ ] Update testcases in `llvm/test/CodeGen/DirectX` to check for corrected attributes. This is dependent on https://github.com/llvm/llvm-project/issues/114461.


### Additional info:

When determining which attributes are needed to describe DXIL intrinsics in `DXIL.td`, we can consider which of these attributes can be queryable and/or a function attribute.

A queryable attribute means that we need to determine if a given intrinsic holds the given attribute. This would be used for analysis (for instance shader flag info). It implies that it is defined in `DXIL.td` and is used to generate a function in `DXILEmitter.cpp` that simply determines if an intrinsic/opcode has the given attribute.

A function attribute means that there is an LLVM IntrinsicProperty that should be passed through to the `dxil` op as a function attribute. This is used to be passed through to the driver. It implies that it is defined in `DXIL.td` and that there is a mapping to a defined IntrinsicProperty.

The first two columns denotes how the attributes are currently defined. The IntrinsicProperty column denotes which IntrinsicProperty that these attributes should generate and attach to the function. And the final two columns denotes if each attribute should be queryable/function atttribute.

If both queryable and function atttribute are No, then it implies we don't need to define the attribute in `DXIL.td`.

| DXC Attr `hctdb.py`     | DXILAttribute `DXIL.td` | IntrinsicProperty `Intrinsics.td` | Queryable  | Function Attribute |
|-------------------------|-------------------------|-----------------------------------|------------|--------------------|
| ReadNone ("rn")         | ReadNone                | IntrNoMem | Yes        | Yes                |
| ReadOnly ("ro") | ReadOnly                | IntrReadMem                       | Yes        | Yes                |
| -                       | -                       | IntrWriteMem                      | No         | No                 |
| ArgMemOnly ("amo")      | -                       | IntrArgMemOnly | Yes        | Yes                |
| is_gradient             | IsGradient              | -                                 | Yes        | No |
| is_deriv                | IsDerivative            | - | Yes        | No                 |
| is_feedback             | IsFeedback              | - | No         | No                 |
| is_wave                 | IsWave                  | IntrConvergent                    | Yes        | Yes                |
| requires_uniform_inputs | NeedsUniformInputs      | -                                 | No         | No                 |
| NoDuplicate ("nd")      | IsBarrier?              | IntrNoDuplicate | Yes        | Yes                |
| NoReturn                | -                       | IntrNoReturn                      | No         | No |

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to