llvm / llvm/llvm-project

Allow multiple mutually independent HWModes to be activated together

Open
#206,836 10 comments 0 reactions 0 assignees View on GitHub
backend:AMDGPU
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Currently it seem only one hwmode can be activated at the same time.

Assuming we have a ModeA controlled by PredA
```
def ModeA : HwMode<[PredA]>;
```

Now we have a Pred B. Assume PredA and PredB are mutually independent, and they can be true at the same time.

To have HwMode control on all possible combination of PredA/B, we need to add cross product:
```
def ModeA : HwMode<[PredA && PredB]>;
def ModeB : HwMode<[PredA && !PredB]>;
def ModeC : HwMode<[!PredA && PredB]>;
def ModeD : HwMode<[!PredA && !PredB]>;
```

This get large and ugly when the number of pred increase. It would be good if the tablegen can automatically recognize the mutually independent predicates, and extend the mode select by itself
```
def ModeA : HwMode<[PredA]>;
def ModeB : HwMode<[PredB]>;

// tablegen auto detect PredA/B and extend the mode select
```

Contributor guide

Open the contributing guide

Research direction

The issue names TableGen's HwMode and predicate-selection behavior but no files or tests. Start by locating the existing HwMode implementation and its handling of predicate combinations. Done means mutually independent predicates can be declared separately and TableGen selects the correct combination without manually writing the cross product.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.