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

[FEA] Atomics codegen refactor #1993

Merged
merged 29 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c59d5a1
Initial draft of new atomics backend
wmaxey Jun 26, 2024
36412ad
Change atomic fetch ops back to tag dispatch
wmaxey Jun 27, 2024
23b759e
Save wip
wmaxey Jun 27, 2024
030b1c1
Add load/store and support for MMIO
wmaxey Jul 2, 2024
5200c7f
Begin working on exch
wmaxey Jul 3, 2024
82ff328
Enable formatting exchange
wmaxey Jul 8, 2024
34318a7
Several signed-ness fixes
wmaxey Jul 9, 2024
6aaa911
Make atomics ptx tests build. Lit tests are a WIP.
wmaxey Jul 9, 2024
ded5872
Fix load/store, some volatileness, and min/max
wmaxey Jul 11, 2024
582e37a
Formatting and enabled codegen in all builds
wmaxey Jul 11, 2024
666c1e0
Make integral.pass.cpp pass
wmaxey Jul 11, 2024
ab73246
Make the rest of the atomics tests pass
wmaxey Jul 11, 2024
0353ac4
Use 128b ld/st instead of vector load as it is not atomic across the …
wmaxey Jul 15, 2024
e469470
Fix copy-paste mistake in load/store
wmaxey Jul 15, 2024
06ae2f8
Whitespace fixup
wmaxey Jul 15, 2024
ac35e4c
Fix 128b .exch using .cas operands
wmaxey Jul 15, 2024
5cca28d
Make codegen link fmt as PRIVATE
wmaxey Jul 19, 2024
6851cda
Simplify MMIO down to a static array.
wmaxey Jul 19, 2024
5ae5c20
Static -> Inline for codegen functions. Replace endl with '\n'.
wmaxey Jul 19, 2024
246248d
Supply the output stream directly to `fmt::format`
wmaxey Jul 19, 2024
222ceb7
Update fmtlib.
wmaxey Jul 19, 2024
073ad71
Revert `fmt::format(out...)` changes. They don't work on MSVC.
wmaxey Jul 19, 2024
a3a3a1f
Fixup libcudacxx codegen CMake stuff
wmaxey Jul 23, 2024
2e884ea
Remove sneaky cstdef include that was auto-added
wmaxey Jul 24, 2024
8de54a6
Merge branch 'main' into fea/atomic_codegen_refactor
wmaxey Jul 24, 2024
7b59560
Merge branch 'main' into fea/atomic_codegen_refactor
wmaxey Aug 2, 2024
bebe369
Merge branch 'main' into fea/atomic_codegen_refactor
miscco Aug 5, 2024
e9110ad
[pre-commit.ci] auto code formatting
pre-commit-ci[bot] Aug 7, 2024
322b106
Merge branch 'main' into fea/atomic_codegen_refactor
wmaxey Aug 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@
"configurePreset": "libcudacxx-codegen",
"filter": {
"include": {
"name": "^libcudacxx\\.atomics\\.codegen.*$"
"name": "^libcudacxx\\.test\\.atomics.codegen.*$"
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion libcudacxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ include(CTest)
enable_testing()

# Add codegen module
option(libcudacxx_ENABLE_CODEGEN "Enable ctest-based testing." OFF)
option(libcudacxx_ENABLE_CODEGEN "Enable libcudacxx's atomics backend codegen and tests." ON)
if (libcudacxx_ENABLE_CODEGEN)
add_subdirectory(codegen)
endif()
Expand Down
28 changes: 14 additions & 14 deletions libcudacxx/codegen/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
## Codegen adds the following build targets
# libcudacxx.atomics.codegen
# libcudacxx.atomics.codegen.execute
# libcudacxx.atomics.codegen.install
## Test targets:
# libcudacxx.atomics.codegen.diff
# libcudacxx.test.atomics.codegen.diff

add_custom_target(libcudacxx.atomics.codegen)
include(${CMAKE_SOURCE_DIR}/cub/cmake/CPM.cmake)
CPMAddPackage("gh:fmtlib/fmt#10.2.1")

add_executable(
codegen
EXCLUDE_FROM_ALL
codegen.cpp
)

target_compile_features(
codegen PRIVATE cxx_std_14
)
target_link_libraries(codegen fmt)
wmaxey marked this conversation as resolved.
Show resolved Hide resolved

add_dependencies(libcudacxx.atomics.codegen codegen)
set_property(TARGET codegen PROPERTY CXX_STANDARD 17)

set(atomic_generated_output "${libcudacxx_BINARY_DIR}/codegen/cuda_ptx_generated.h")
set(atomic_install_location "${libcudacxx_SOURCE_DIR}/include/cuda/std/__atomic/functions")

add_custom_target(
libcudacxx.atomics.codegen.execute
COMMAND codegen
libcudacxx.atomics.codegen
COMMAND codegen "${atomic_generated_output}"
BYPRODUCTS "${atomic_generated_output}"
)

add_dependencies(libcudacxx.atomics.codegen libcudacxx.atomics.codegen.execute)

add_custom_target(
libcudacxx.atomics.codegen.install
COMMAND ${CMAKE_COMMAND} -E copy "${atomic_generated_output}" "${atomic_install_location}/cuda_ptx_generated.h"
DEPENDS libcudacxx.atomics.codegen
BYPRODUCTS "${atomic_install_location}/cuda_ptx_generated.h"
)

add_dependencies(libcudacxx.atomics.codegen.install libcudacxx.atomics.codegen.execute)

add_test(
NAME libcudacxx.atomics.codegen.diff
NAME libcudacxx.test.atomics.codegen.diff
COMMAND ${CMAKE_COMMAND} -E compare_files "${atomic_install_location}/cuda_ptx_generated.h" "${atomic_generated_output}"
)

set_tests_properties(
libcudacxx.test.atomics.codegen.diff
PROPERTIES REQUIRED_FILES "${atomic_generated_output}"
)
Loading
Loading