Skip to content

Conversation

@s-barannikov
Copy link
Contributor

@s-barannikov s-barannikov commented Dec 12, 2024

RFC

Landed changes:
#138381 RISCV
#138450 Sparc
#138869 XCore
#138874 ARC, CSKY, Lanai
#138878 MSP430
#139407 AVR
#139449 M68k
#140472 AArch64
#166253 Xtensa
#166259 WebAssembly
#166499 BPF
#168108 PowerPC
#168113 SystemZ
#168120 VE
#168129 LoongArch
#168212 ARM
#168248 AMDGPU
#168367 NVPTX

@github-actions

This comment was marked as off-topic.

@llvm llvm deleted a comment from github-actions bot Dec 12, 2024
@s-barannikov s-barannikov force-pushed the tablegen/sdnode-info-emitter branch from 2a57488 to b90b16f Compare December 12, 2024 16:44
@github-actions

This comment was marked as off-topic.

/// Test if this node has a target-specific
/// memory-referencing opcode (in the \<target\>ISD namespace and
/// greater than FIRST_TARGET_MEMORY_OPCODE).
bool isTargetMemoryOpcode() const {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we still need isTargetMemoryOpcode(). It doesn't have any callers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It has one use in the assert in SelectionDAG::getMemIntrinsicNode.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oops. I was looking in my local repo and should have checked for FIRST_TARGET_MEMORY_OPCODE to see that assert

Copy link
Collaborator

Choose a reason for hiding this comment

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

If nothing else is checking it, does that assert provide any value? Can we just allow any target opcode to be a memory opcode?

Copy link
Contributor Author

@s-barannikov s-barannikov Dec 12, 2024

Choose a reason for hiding this comment

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

I remembered it has one more "use". Before this patch it is implicitly checked here. isTargetStrictFPOpcode returns true for memory opcodes as well. mayRaiseFPException is then used here to decide whether the resulting MachineInstr needs NoFPExcept flag. IIUC it will not set this flag on MachineInstrs if the matched SDNode(s) were flagged as memory accessing (or having strict-fp semantics).

This behavior was introduced in 6333679. I couldn't conclude if it is safe to return false for memory opcodes so I left it as is.

After this patch the check is explicit, please see SelectionDAGTargetInfo.cpp:mayRaiseFPException.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I ran CodeGen tests with the memory opcode check disabled and there was one failure in
X86/fp-intrinsics-flags.ll. The following diff resolves it:

image

There was a discussion in https://reviews.llvm.org/D72466 that can be related to this. Can you confirm that this is a safe change? If so, then quoting @uweigand from https://reviews.llvm.org/D71841 I assume the check for memory opcode can be dropped:

Note that there a bit of a quirk in identifying target nodes that are both memory nodes and strict FP nodes. To simplify the logic, right now all target memory nodes are automatically also considered strict FP nodes -- this could be fixed by adding one more range.

@s-barannikov s-barannikov marked this pull request as ready for review December 13, 2024 13:37
@s-barannikov s-barannikov force-pushed the tablegen/sdnode-info-emitter branch from b90b16f to ad38786 Compare December 14, 2024 12:34
s-barannikov added a commit to s-barannikov/llvm-project that referenced this pull request Dec 14, 2024
A future patch adds a couple of new methods to this class,
which will need to be overridden by these targets.

Part of llvm#119709.
s-barannikov added a commit that referenced this pull request Dec 16, 2024
…argets (#119968)

#119969 adds a couple of new methods to this class, which will need to
be overridden by these targets.

Part of #119709.

Pull Request: #119968
@s-barannikov s-barannikov force-pushed the tablegen/sdnode-info-emitter branch from ad38786 to 7ed14ef Compare December 16, 2024 20:32
s-barannikov added a commit that referenced this pull request Dec 21, 2024
…de (#119969)

With this change, targets are no longer required to put memory / strict-fp opcodes after special
`ISD::FIRST_TARGET_MEMORY_OPCODE`/`ISD::FIRST_TARGET_STRICTFP_OPCODE` markers.
This will also allow autogenerating `isTargetMemoryOpcode`/`isTargetStrictFPOpcode (#119709).

Pull Request: #119969
@s-barannikov s-barannikov force-pushed the tablegen/sdnode-info-emitter branch 3 times, most recently from 7dd3721 to c315879 Compare December 21, 2024 15:10
@s-barannikov s-barannikov force-pushed the tablegen/sdnode-info-emitter branch 2 times, most recently from 5d1058f to 3ba779a Compare January 14, 2025 18:44
s-barannikov added a commit to s-barannikov/llvm-project that referenced this pull request Jan 15, 2025
This patch adds a simplistic backend that gathers all target-specific
SelectionDAG nodes and emits descriptions for most of them.

This includes generating node enumeration, node names, and information
about node "prototype" that can be used to verify that a node is valid.

The patch also extends SDNode by adding target-specific flags, which
are also included in the generated tables.

Part of llvm#119709, [RFC](https://discourse.llvm.org/t/rfc-tablegen-erating-sdnode-descriptions/83627).
s-barannikov added a commit to s-barannikov/llvm-project that referenced this pull request Jan 15, 2025
This patch adds a simplistic backend that gathers all target-specific
SelectionDAG nodes and emits descriptions for most of them.

This includes generating node enumeration, node names, and information
about node "prototype" that can be used to verify that a node is valid.

The patch also extends SDNode by adding target-specific flags, which
are also included in the generated tables.

Part of llvm#119709, [RFC](https://discourse.llvm.org/t/rfc-tablegen-erating-sdnode-descriptions/83627).
s-barannikov added a commit that referenced this pull request Jan 22, 2025
This patch adds a simplistic backend that gathers all target-specific
SelectionDAG nodes and emits descriptions for most of them.

This includes generating node enumeration, node names, and information
about node "prototype" that can be used to verify that a node is valid.

The patch also extends SDNode by adding target-specific flags, which are
also included in the generated tables.

Part of #119709,
[RFC](https://discourse.llvm.org/t/rfc-tablegen-erating-sdnode-descriptions/83627).

Pull Request: #123002
@s-barannikov s-barannikov force-pushed the tablegen/sdnode-info-emitter branch from 3ba779a to 4c7893b Compare January 22, 2025 06:20
@s-barannikov s-barannikov force-pushed the tablegen/sdnode-info-emitter branch from 4c7893b to ae89705 Compare February 1, 2025 19:08
s-barannikov added a commit to s-barannikov/llvm-project that referenced this pull request Feb 1, 2025
This patch introduces SelectionDAGGenTargetInfo and SDNodeInfo classes,
which provide methods for accessing the generated SDNode descriptions.

RFC: https://discourse.llvm.org/t/rfc-tablegen-erating-sdnode-descriptions
Draft PR: llvm#119709
s-barannikov added a commit that referenced this pull request Nov 17, 2025
This allows SDNodes to be validated against their expected type profiles
and reduces the number of changes required to add a new node.

There is only one node that is missing a description -- `GET_CCMASK`,
others were successfully imported.

Part of #119709.

Pull Request: #168113
@s-barannikov s-barannikov force-pushed the tablegen/sdnode-info-emitter branch from f425081 to 38d2191 Compare November 17, 2025 21:41
@github-actions
Copy link

github-actions bot commented Nov 17, 2025

🐧 Linux x64 Test Results

  • 186423 tests passed
  • 4867 tests skipped

s-barannikov added a commit that referenced this pull request Nov 17, 2025
This allows SDNodes to be validated against their expected type profiles
and reduces the number of changes required to add a new node.

The validation functionality has detected several issues, see
`PPCSelectionDAGInfo::verifyTargetNode()`.

Most of the nodes have a description in `*.td` files and were
successfully "imported". Those that don't have a description are listed
in the enum in `PPCSelectionDAGInfo.td`. These nodes are not validated.

Part of #119709.

Pull Request: #168108
@s-barannikov s-barannikov force-pushed the tablegen/sdnode-info-emitter branch from 38d2191 to 5fd7c92 Compare November 18, 2025 00:23
s-barannikov added a commit that referenced this pull request Nov 18, 2025
This allows SDNodes to be validated against their expected type profiles
and reduces the number of changes required to add a new node.

Some nodes fail validation, those are enumerated in
`ARMSelectionDAGInfo::verifyTargetNode()`. Some of the bugs are easy to
fix, but probably they should be fixed separately, this patch is already big.

Part of #119709.

Pull Request: #168212
@s-barannikov s-barannikov force-pushed the tablegen/sdnode-info-emitter branch from 5fd7c92 to eba3dc9 Compare November 18, 2025 18:45
s-barannikov added a commit that referenced this pull request Nov 18, 2025
This allows SDNodes to be validated against their expected type profiles
and reduces the number of changes required to add a new node.

The verification functionality detected a few issues, two of them were
fixed (missing `SDNPMemOperand` property on `TCGEN05_MMA` nodes and
extra glue operand/result on `CallPrototype`), the one remaining is with
`ProxyReg` node, see `NVPTXSelectionDAGInfo::verifyTargetNode()`.

Part of #119709.

Pull Request: #168367
@s-barannikov s-barannikov force-pushed the tablegen/sdnode-info-emitter branch from eba3dc9 to 38ecac7 Compare November 18, 2025 23:49
s-barannikov added a commit that referenced this pull request Nov 20, 2025
This allows SDNodes to be validated against their expected type profiles
and reduces the number of changes required to add a new node.

I had to split `VSHUF4I` into two variants (`VSHUF4I` and `VSHUF4I_D`)
since `loongarch_vshuf4i` and `loongarch_vshuf4i_d` have different
number of operands, and this prevented the node from being imported.

There is just one node that currently fails validation, see
`LoongArchSelectionDAGInfo::verifyTargetNode()`.

Part of #119709.

Pull Request: #168129
@s-barannikov s-barannikov force-pushed the tablegen/sdnode-info-emitter branch from 38ecac7 to d8dbcb0 Compare November 20, 2025 15:33
aadeshps-mcw pushed a commit to aadeshps-mcw/llvm-project that referenced this pull request Nov 26, 2025
This allows SDNodes to be validated against their expected type profiles
and reduces the number of changes required to add a new node.

Autogenerated node names start with "AMDGPUISD::", hence the changes in
the tests.

The few nodes defined in R600.td are *not* imported because TableGen
processes AMDGPU.td that doesn't include R600.td. Ideally, we would have
two sets of nodes, but that would require careful reorganization of td
files since some nodes are shared between AMDGPU/R600. Not sure if it
something worth looking into.

Some nodes fail validation, those are listed in
`AMDGPUSelectionDAGInfo::verifyTargetNode()`.

Part of llvm#119709.

Pull Request: llvm#168248
aadeshps-mcw pushed a commit to aadeshps-mcw/llvm-project that referenced this pull request Nov 26, 2025
This allows SDNodes to be validated against their expected type profiles
and reduces the number of changes required to add a new node.

There is only one node that is missing a description -- `GET_CCMASK`,
others were successfully imported.

Part of llvm#119709.

Pull Request: llvm#168113
aadeshps-mcw pushed a commit to aadeshps-mcw/llvm-project that referenced this pull request Nov 26, 2025
This allows SDNodes to be validated against their expected type profiles
and reduces the number of changes required to add a new node.

The validation functionality has detected several issues, see
`PPCSelectionDAGInfo::verifyTargetNode()`.

Most of the nodes have a description in `*.td` files and were
successfully "imported". Those that don't have a description are listed
in the enum in `PPCSelectionDAGInfo.td`. These nodes are not validated.

Part of llvm#119709.

Pull Request: llvm#168108
aadeshps-mcw pushed a commit to aadeshps-mcw/llvm-project that referenced this pull request Nov 26, 2025
This allows SDNodes to be validated against their expected type profiles
and reduces the number of changes required to add a new node.

Some nodes fail validation, those are enumerated in
`ARMSelectionDAGInfo::verifyTargetNode()`. Some of the bugs are easy to
fix, but probably they should be fixed separately, this patch is already big.

Part of llvm#119709.

Pull Request: llvm#168212
aadeshps-mcw pushed a commit to aadeshps-mcw/llvm-project that referenced this pull request Nov 26, 2025
This allows SDNodes to be validated against their expected type profiles
and reduces the number of changes required to add a new node.

The verification functionality detected a few issues, two of them were
fixed (missing `SDNPMemOperand` property on `TCGEN05_MMA` nodes and
extra glue operand/result on `CallPrototype`), the one remaining is with
`ProxyReg` node, see `NVPTXSelectionDAGInfo::verifyTargetNode()`.

Part of llvm#119709.

Pull Request: llvm#168367
aadeshps-mcw pushed a commit to aadeshps-mcw/llvm-project that referenced this pull request Nov 26, 2025
This allows SDNodes to be validated against their expected type profiles
and reduces the number of changes required to add a new node.

I had to split `VSHUF4I` into two variants (`VSHUF4I` and `VSHUF4I_D`)
since `loongarch_vshuf4i` and `loongarch_vshuf4i_d` have different
number of operands, and this prevented the node from being imported.

There is just one node that currently fails validation, see
`LoongArchSelectionDAGInfo::verifyTargetNode()`.

Part of llvm#119709.

Pull Request: llvm#168129
Priyanshu3820 pushed a commit to Priyanshu3820/llvm-project that referenced this pull request Nov 26, 2025
This allows SDNodes to be validated against their expected type profiles
and reduces the number of changes required to add a new node.

Some nodes fail validation, those are enumerated in
`ARMSelectionDAGInfo::verifyTargetNode()`. Some of the bugs are easy to
fix, but probably they should be fixed separately, this patch is already big.

Part of llvm#119709.

Pull Request: llvm#168212
Priyanshu3820 pushed a commit to Priyanshu3820/llvm-project that referenced this pull request Nov 26, 2025
This allows SDNodes to be validated against their expected type profiles
and reduces the number of changes required to add a new node.

The verification functionality detected a few issues, two of them were
fixed (missing `SDNPMemOperand` property on `TCGEN05_MMA` nodes and
extra glue operand/result on `CallPrototype`), the one remaining is with
`ProxyReg` node, see `NVPTXSelectionDAGInfo::verifyTargetNode()`.

Part of llvm#119709.

Pull Request: llvm#168367
Priyanshu3820 pushed a commit to Priyanshu3820/llvm-project that referenced this pull request Nov 26, 2025
This allows SDNodes to be validated against their expected type profiles
and reduces the number of changes required to add a new node.

I had to split `VSHUF4I` into two variants (`VSHUF4I` and `VSHUF4I_D`)
since `loongarch_vshuf4i` and `loongarch_vshuf4i_d` have different
number of operands, and this prevented the node from being imported.

There is just one node that currently fails validation, see
`LoongArchSelectionDAGInfo::verifyTargetNode()`.

Part of llvm#119709.

Pull Request: llvm#168129
augusto2112 pushed a commit to augusto2112/llvm-project that referenced this pull request Dec 3, 2025
This allows SDNodes to be validated against their expected type profiles
and reduces the number of changes required to add a new node.

I had to split `VSHUF4I` into two variants (`VSHUF4I` and `VSHUF4I_D`)
since `loongarch_vshuf4i` and `loongarch_vshuf4i_d` have different
number of operands, and this prevented the node from being imported.

There is just one node that currently fails validation, see
`LoongArchSelectionDAGInfo::verifyTargetNode()`.

Part of llvm#119709.

Pull Request: llvm#168129
s-barannikov added a commit that referenced this pull request Dec 5, 2025
This allows SDNodes to be validated against their expected type profiles
and reduces the number of changes required to add a new node.

Many DSP nodes were failing validation, this is fixed as part of this
PR.

Part of #119709.

Pull Request: #168307
honeygoyal pushed a commit to honeygoyal/llvm-project that referenced this pull request Dec 9, 2025
This allows SDNodes to be validated against their expected type profiles
and reduces the number of changes required to add a new node.

Many DSP nodes were failing validation, this is fixed as part of this
PR.

Part of llvm#119709.

Pull Request: llvm#168307
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.

4 participants