Skip to content
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

Introduce ResultError to support Result-based llvm::Errors #1545

Merged
merged 1 commit into from Nov 30, 2021

Conversation

kuhar
Copy link
Contributor

@kuhar kuhar commented Nov 27, 2021

Introduce a new class Llpc::ResultError that implements a Result-based
llvm::Error type. This is primarily to support returning either error results
or values with llvm::Expected<T>.

Also implement the necessary utility functions, and move some existing ones to the
new header.

I also considered using llvm::StringError directly, but this did not work well as
some Vkgc::Result values do not map well to any std::errc error codes, and it was
difficult to convert back to Vkgc::Result, which many existing APIs expect.

See the mailing list thread [RFC] Improving LLPC Result checking for the proposal
details.

@kuhar
Copy link
Contributor Author

kuhar commented Nov 29, 2021

V1: Rebase, no code changes.

Ping for review @amdrexu @trenouf @dstutt @bsaleil

@amdvlk-admin
Copy link
Collaborator

Test summary for commit 19581ef

Driver commits used in build
  • CWPACK: amd-master 7387247eb9889ddcabbc1053b9c2052e253b088e
  • METROHASH: amd-master 3c566dd9cda44ca7fd97659e0b53ac953f9037d2
  • PAL: dev f49a7f3f706dd721d9a7b620be1482217ef63b6e
  • SPVGEN: dev efa3cec20c6ebc66254ff9cca9b3ea124811d7a3
  • XGL: dev 3ad7e89650fa241be349688564d4defe3fbada92
  • LLVM-PROJECT: amd-gfx-gpuopen-dev cdd74831d061bf65fdf5af4a0b6ce99fe2c558a9
CTS tests (Failed: 0/225388)
  • Built with version 1.2.5.2
  • Rhel 8.2, Gfx10
    • Passed: 31425/56347 (55.8%)
    • Failed: 0/56347 (0.0%)
    • Not Supported: 24922/56347 (44.2%)
    Ubuntu 18.04, Gfx9
    • Passed: 31413/56347 (55.7%)
    • Failed: 0/56347 (0.0%)
    • Not Supported: 24934/56347 (44.3%)
    Ubuntu 20.04, Gfx8
    • Passed: 31748/56347 (56.3%)
    • Failed: 0/56347 (0.0%)
    • Not Supported: 24599/56347 (43.7%)
    Ubuntu 20.04, Gfx103
    • Passed: 34582/56347 (61.4%)
    • Failed: 0/56347 (0.0%)
    • Not Supported: 21765/56347 (38.6%)

Introduce a new class `Llpc::ResultError` that implements a `Result`-based
`llvm::Error` type. This is primarily to support returning either error results
or values with `llvm::Expected<T>`.

Also implement the necessary utility functions, and move some existing ones to the
new header.

I also considered using `llvm::StringError` directly, but this did not work well as
some `Vkgc::Result` values do not map well to any `std::errc` error codes, and it was
difficult to convert back to `Vkgc::Result`, which many existing APIs expect.

See the mailing list thread `[RFC] Improving LLPC Result checking` for the proposal
details.
@kuhar
Copy link
Contributor Author

kuhar commented Nov 29, 2021

V2: Silence a clang-tidy warning.

@Flakebi
Copy link
Member

Flakebi commented Nov 30, 2021

I don’t see these clang-tidy warnings when running it locally, so I guess they will go away once we can update llvm in the containers.

Copy link
Member

@dstutt dstutt left a comment

Choose a reason for hiding this comment

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

LGTM
Nice - (I especially liked the examples in the header)

@trenouf
Copy link
Member

trenouf commented Nov 30, 2021

The Jenkins run went even more wrong than normal, so I can't see test passes in it. I think we'd better try again.

@trenouf
Copy link
Member

trenouf commented Nov 30, 2021

retest this please

@trenouf
Copy link
Member

trenouf commented Nov 30, 2021

Hmm, maybe that doesn't work any more. I'll cherry-pick it to our internal branch and do a test run there; that should give some more confidence.

@amdvlk-admin
Copy link
Collaborator

Test summary for commit e1d583d

Driver commits used in build
  • CWPACK: amd-master 7387247eb9889ddcabbc1053b9c2052e253b088e
  • METROHASH: amd-master 3c566dd9cda44ca7fd97659e0b53ac953f9037d2
  • PAL: dev f49a7f3f706dd721d9a7b620be1482217ef63b6e
  • SPVGEN: dev efa3cec20c6ebc66254ff9cca9b3ea124811d7a3
  • XGL: dev 3ad7e89650fa241be349688564d4defe3fbada92
  • LLVM-PROJECT: amd-gfx-gpuopen-dev cdd74831d061bf65fdf5af4a0b6ce99fe2c558a9
CTS tests (Failed: 0/225388)
  • Built with version 1.2.5.2
  • Rhel 8.2, Gfx10
    • Passed: 31425/56347 (55.8%)
    • Failed: 0/56347 (0.0%)
    • Not Supported: 24922/56347 (44.2%)
    Ubuntu 18.04, Gfx9
    • Passed: 31413/56347 (55.7%)
    • Failed: 0/56347 (0.0%)
    • Not Supported: 24934/56347 (44.3%)
    Ubuntu 20.04, Gfx8
    • Passed: 31748/56347 (56.3%)
    • Failed: 0/56347 (0.0%)
    • Not Supported: 24599/56347 (43.7%)
    Ubuntu 20.04, Gfx103
    • Passed: 34582/56347 (61.4%)
    • Failed: 0/56347 (0.0%)
    • Not Supported: 21765/56347 (38.6%)

@trenouf
Copy link
Member

trenouf commented Nov 30, 2021

Rex told me how to internally retrigger the Jenkins build here, and it passed all tests (and it got there before internal testing).

@trenouf trenouf merged commit 3efbccc into GPUOpen-Drivers:dev Nov 30, 2021
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.

None yet

5 participants