This is an archive of the discontinued LLVM Phabricator instance.

[libc] Enable running libc unit tests on NVPTX
ClosedPublic

Authored by jhuber6 on Apr 29 2023, 2:19 PM.

Details

Summary

The previous patches added the necessary support for global constructors
used to register tests. This patch enables the NVPTX target to build
and run the unit tests on the GPU. Currently this only tests the ctype
tests, but adding more should be straightforward from here on.

This ran all the ctest unit tests when run on an sm_70.

Depends on D149517 D149527

Diff Detail

Event Timeline

jhuber6 created this revision.Apr 29 2023, 2:19 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 29 2023, 2:19 PM
jhuber6 requested review of this revision.Apr 29 2023, 2:19 PM
jhuber6 updated this revision to Diff 518522.May 1 2023, 12:08 PM

Changing to use '-fno-use-cxa-atexit'.

sivachandra accepted this revision.May 1 2023, 12:31 PM

OK after addressing the inline comment.

libc/test/UnitTest/CMakeLists.txt
30

Instead of large if/else block, can you do something like:

if(LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
  set(library_type OBJECT)
else()
  set(library_type STATIC)
endif()

And then add ${library_type} to all of the libraries below.

This revision is now accepted and ready to land.May 1 2023, 12:31 PM
jhuber6 updated this revision to Diff 518531.May 1 2023, 12:35 PM

Addressing comment

jhuber6 updated this revision to Diff 519456.May 4 2023, 5:43 AM

Disable this test, causes link failured due toredefined main on NVPTX.

jhuber6 updated this revision to Diff 519466.May 4 2023, 6:30 AM

Disabling three tests that fail on NVPTX. Will work to reenable these later.

This revision was landed with ongoing or failed builds.May 4 2023, 6:36 AM
This revision was automatically updated to reflect the committed changes.