Skip to content

[HLSL] Add support for root constant generation from llvm IR. #127932

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

Closed
wants to merge 219 commits into from

Conversation

joaosaffran
Copy link
Contributor

This PR adds support for root constant metadata extraction and generation in dxcontainer. It's changes include:

  • Parsing of root constants from llvm ir metadata.
  • validations of parsed elements.
  • adding extracted data in dx container globals.
  • tests.

topperc and others added 26 commits March 3, 2025 20:25
… a virtual register. (llvm#129017)

NVPTX needs to be able to get the Dwarf register number for a virtual
register. The interface we have for this today is on MCRegisterInfo and
take a MCRegister argument. It shouldn't be legal to convert a Register
containing a virtual register to an MCRegister.

This patch adds a getDwarfRegNumForVirtReg function that takes a
Register to TRI and splits the NVPTX override of getDwarfRegNum.
…auses of taskloop construct (llvm#128477)

Added modifier(strict) support to the granularity(grainsize and num_tasks) clauses of taskloop construct.
…m#129066)

When we need to reclone other callees of a caller node during function
assignment due to the creation of a new function clone, we need to skip
recursive edges on that caller. We don't want to reclone the callee in
that case (which is the caller), which isn't necessary and also isn't
correct from a graph update perspective. It resulted in an assertion and
in an NDEBUG build caused an infinite loop.
…ars with multi uses

If the vectorized scalars has multiple uses, need to check if it is safe
to truncate the vectorized value, before actually trying doing it.
Otherwise, the compiler may loose some important bits, which may lead to
a miscompilation.

Fixes llvm#129057
This set usage of operator& instead of std::addressof seems not be easy
to "abuse". Some seem easy to misuse, like basic_ostream::operator<<,
trying to do that results in compilation errors since the `widen`
function is not specialized for the hijacking character type. Hence
there are no tests.
…lvm#128897)

This patch changes the codegen for non-precise erfc calls to generate
math.erfc ops. This wasn't done before because the math dialect did not
have a erfc operation at the time.
…vm#126068)

Multiple improvements to make the messages more concrete, actionable and
less confusing when multiple prefixes are used in `-verify=`. The common
theme among these was that prior to the patch all error messages would
use the alphabetically first prefix, even if the error was associated
with a different one.

- Mention the actual expected but unseen directive: Prior to this change
when reporting expected but unseen directive, the alphabetically first
one would be used to report the error even if that's not the one present
in the source. Reword the diagnostic if multiple prefixes are active and
include the real spelling of the expected directive for each expected
but not seen line in the output.

- Reword the seen but not expected error message if multiple directives
are active to avoid having to pick an arbitrary (the first) prefix for
it.

- Include the full spelling of the directive when reporting a directive
following the no-diagnostics directive. For example "'foo-error'
directive cannot follow 'foo-no-diagnostics' directive"

- Use the first appearing `-no-diagnostics` directive, in the above
message instead of the first one alphabetically.

The new wording
> diagnostics with '(error|warning|remark|note)' severity seen but not
expected

instead of

> '<prefix>-(error|warning|remark|note)' diagnostics seen but not
expected

is only used when multiple prefixes are present, the error messages stay
the same with a single prefix only.
For GFX10+ the destination reg of v_cmpx instructions is implicitly EXEC,
which is encoded as 0x7E. However, the disassembler does not check this
field, thus allowing any value. With this patch, if the field is not
EXEC a warning is issued.
…lvm#126621)" (llvm#129078)

This reverts commit 1559a65.

Fixed test (I suspect broken by unrelated change in the merge)
Previously checker objects were created by raw `new` calls, which
necessitated managing and calling their destructors explicitly. This
commit refactors this convoluted logic by introducing `unique_ptr`s that
to manage the ownership of these objects automatically.

This change can be thought of as stand-alone code quality improvement;
but I also have a secondary motivation that I'm planning further changes
in the checker registration/initialization process (to formalize our
tradition of multi-part checker) and this commit "prepares the ground"
for those changes.
)

Avoid negations for normalized blends by reordering operands.

PR: llvm#128375
In several cases the flags entries in ompt_frame_t are not initialized.
According to @jdelsign the address provided as reenter and exit address
is the canonical frame address (cfa) rather than a "framepointer". This
patch makes sure that the flags entry is always initialized and changes
the value from ompt_frame_framepointer to ompt_frame_cfa.

The assertion in the tests makes sure that the flags are always set,
when a tool (callback.h in this case) looks at the value.

Fixes llvm#89058
PeepholeOpt has a nicer version of this which handles more
cases.
Shared state between dependency scanning workers is managed by the
dependency scanning service.

Right now, the members are individually threaded through the worker,
action, and collector. This makes any change to the service and its
members a very laborious process. Moreover, this situation causes
frequent merge conflicts in our downstream repo where the service does
have some extra members that need to be passed around.

To ease the maintenance burden, this PR starts passing a reference to
the entire service.
…-back (llvm#128092)

This patch fixes the behavior of the scheduler by making sure the instrs
that are part of a SchedBundle are scheduled back-to-back.
@joaosaffran joaosaffran force-pushed the root-signature/root-constants branch from d6ace04 to 79cdfff Compare March 3, 2025 21:22
@nikic
Copy link
Contributor

nikic commented Mar 3, 2025

Please open a new PR after verifying that it only contains your changes.

@nikic nikic closed this Mar 3, 2025
@github-project-automation github-project-automation bot moved this to Closed in HLSL Support Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.