[PATCH] D121727: [NVPTX] Integrate ptxas to LIT tests

Andrew Savonichev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 17 13:39:34 PDT 2022


asavonic added a comment.

In D121727#3387211 <https://reviews.llvm.org/D121727#3387211>, @tra wrote:

> Ideally we'd want lit to provide a way to make some RUN lines conditional on available features, so we could run more tests when we can, without having to rewrite the file.
> And we don't have anything like that.
>
> That said, I'm still not quite happy about substituting it with 'true'. 
> Perhaps we can do it slightly differently:
>
> - do not run RUN lines with `ptxas` in them unless the feature is available, and
> - document this auto-disabled behavior of `ptxas` in LLVM's lit docs.
>
> This should give us more consistent behavior. E.g. if someone writes a test checking ptxas output with `FileCheck`, it would still work consistently. Replacing ptxas with true would cause the test to fail in this scenario, because the RUN line would still be executed and FileCheck would expect to see the output.
> It's not quite like predicating RUN lines based on available features, but it would be close enough to be usable in this case. Combined with documentation that may do.

Ok, so I made a draft implementation of conditional execution of RUN commands. We can now decide what approach is better:

  RUN: ptxas-verify %t-nvptx.ptx
  RUN: %(when ptxas ptxas -c %t-nvptx.ptx -o /dev/null)

The first one is substituted to `true` if `ptxas`executable is not available. It does not expose output machine code, so there is no issues with a pipelined FileCheck invocation.
The second one is a new feature of LIT: `%(when cond command)` is expanded to `command` if `cond` feature is available.

If we decide to proceed with the second approach, I'll finalize and submit it as a separate patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121727/new/

https://reviews.llvm.org/D121727



More information about the llvm-commits mailing list