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

Add infrastructure for compile-time CUB tests #1124

Merged
merged 1 commit into from
Nov 20, 2023

Conversation

gevtushenko
Copy link
Collaborator

Description

closes #1123

This PR introduces necessary infrastructure for compile-time CUB tests. Tests that ends with _fail are treated as compile-time tests. Example:

// %PARAM% TEST_ERR err 0:1

int main()
{
  #if TEST_ERR == 0
  static_assert(false, "fail one"); 
  #elif TEST_ERR == 1
  static_assert(false, "fail two"); // expected-error-1 {{"fail two"}}
  #endif
}

Test above is compiled twice, for TEST_ERR = 0 and TEST_ERR = 1. In the first case, ctest relies on compiler return code to detect issue. In the second case, ctest expects fail two message in the compiler output. More usage examples can be found in the following tests:

  • cub/test/test_device_radix_sort_decomposer_fail.cu
  • cub/test/test_fail.cu
  • cub/test/test_param_fail.cu
  • cub/test/test_param_return_code_fail.cu
  • cub/test/test_return_code_fail.cu.

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@gevtushenko gevtushenko requested review from a team as code owners November 17, 2023 22:51
@gevtushenko gevtushenko requested review from wmaxey, griwes, elstehle and alliepiper and removed request for a team November 17, 2023 22:51
@alliepiper
Copy link
Collaborator

LGTM -- this is very useful!

@gevtushenko gevtushenko merged commit 1be25a5 into NVIDIA:main Nov 20, 2023
517 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[FEA]: Add infrastructure for compile-time CUB tests
2 participants