From 68adf451268ca9524ad556a9fe2206946db1a929 Mon Sep 17 00:00:00 2001 From: Kirthi Shankar Sivamani Date: Mon, 11 Nov 2024 06:37:44 -0800 Subject: [PATCH] Convert non-kernel cuda files to cpp (#1322) * Fix file extensions Signed-off-by: Kirthi Shankar Sivamani * fix build Signed-off-by: Kirthi Shankar Sivamani * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * upgrade paddle container for CI Signed-off-by: Kirthi Shankar Sivamani --------- Signed-off-by: Kirthi Shankar Sivamani Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/workflows/build.yml | 2 +- build_tools/paddle.py | 2 +- build_tools/pytorch.py | 2 +- .../paddle/csrc/{extensions.cu => extensions.cpp} | 0 transformer_engine/pytorch/csrc/{common.cu => common.cpp} | 1 + .../pytorch/csrc/extensions/{activation.cu => activation.cpp} | 0 .../pytorch/csrc/extensions/{apply_rope.cu => apply_rope.cpp} | 0 .../pytorch/csrc/extensions/{cast.cu => cast.cpp} | 0 .../pytorch/csrc/extensions/{gemm.cu => gemm.cpp} | 0 .../pytorch/csrc/extensions/{misc.cu => misc.cpp} | 0 .../csrc/extensions/{normalization.cu => normalization.cpp} | 0 .../pytorch/csrc/extensions/{padding.cu => padding.cpp} | 0 .../pytorch/csrc/extensions/{recipe.cu => recipe.cpp} | 0 .../pytorch/csrc/extensions/{softmax.cu => softmax.cpp} | 0 .../pytorch/csrc/extensions/{transpose.cu => transpose.cpp} | 0 15 files changed, 4 insertions(+), 3 deletions(-) rename transformer_engine/paddle/csrc/{extensions.cu => extensions.cpp} (100%) rename transformer_engine/pytorch/csrc/{common.cu => common.cpp} (99%) rename transformer_engine/pytorch/csrc/extensions/{activation.cu => activation.cpp} (100%) rename transformer_engine/pytorch/csrc/extensions/{apply_rope.cu => apply_rope.cpp} (100%) rename transformer_engine/pytorch/csrc/extensions/{cast.cu => cast.cpp} (100%) rename transformer_engine/pytorch/csrc/extensions/{gemm.cu => gemm.cpp} (100%) rename transformer_engine/pytorch/csrc/extensions/{misc.cu => misc.cpp} (100%) rename transformer_engine/pytorch/csrc/extensions/{normalization.cu => normalization.cpp} (100%) rename transformer_engine/pytorch/csrc/extensions/{padding.cu => padding.cpp} (100%) rename transformer_engine/pytorch/csrc/extensions/{recipe.cu => recipe.cpp} (100%) rename transformer_engine/pytorch/csrc/extensions/{softmax.cu => softmax.cpp} (100%) rename transformer_engine/pytorch/csrc/extensions/{transpose.cu => transpose.cpp} (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 896d8f927e..7039d38cf5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -76,7 +76,7 @@ jobs: name: 'PaddlePaddle' runs-on: ubuntu-latest container: - image: nvcr.io/nvidia/paddlepaddle:24.07-py3 + image: nvcr.io/nvidia/paddlepaddle:24.10-py3 options: --user root steps: - name: 'Checkout' diff --git a/build_tools/paddle.py b/build_tools/paddle.py index f410682875..a68d73956e 100644 --- a/build_tools/paddle.py +++ b/build_tools/paddle.py @@ -25,7 +25,7 @@ def setup_paddle_extension( # Source files csrc_source_files = Path(csrc_source_files) sources = [ - csrc_source_files / "extensions.cu", + csrc_source_files / "extensions.cpp", csrc_source_files / "common.cpp", csrc_source_files / "custom_ops.cu", ] diff --git a/build_tools/pytorch.py b/build_tools/pytorch.py index e7924d8a21..575b7bee79 100644 --- a/build_tools/pytorch.py +++ b/build_tools/pytorch.py @@ -26,7 +26,7 @@ def setup_pytorch_extension( csrc_source_files = Path(csrc_source_files) extensions_dir = csrc_source_files / "extensions" sources = [ - csrc_source_files / "common.cu", + csrc_source_files / "common.cpp", csrc_source_files / "ts_fp8_op.cpp", ] + all_files_in_dir(extensions_dir) diff --git a/transformer_engine/paddle/csrc/extensions.cu b/transformer_engine/paddle/csrc/extensions.cpp similarity index 100% rename from transformer_engine/paddle/csrc/extensions.cu rename to transformer_engine/paddle/csrc/extensions.cpp diff --git a/transformer_engine/pytorch/csrc/common.cu b/transformer_engine/pytorch/csrc/common.cpp similarity index 99% rename from transformer_engine/pytorch/csrc/common.cu rename to transformer_engine/pytorch/csrc/common.cpp index 2d8e602c5b..2ac190863c 100644 --- a/transformer_engine/pytorch/csrc/common.cu +++ b/transformer_engine/pytorch/csrc/common.cpp @@ -5,6 +5,7 @@ ************************************************************************/ #include "common.h" + #include "transformer_engine/transformer_engine.h" transformer_engine::DType getTransformerEngineFP8Type(bool e4m3_if_hybrid, diff --git a/transformer_engine/pytorch/csrc/extensions/activation.cu b/transformer_engine/pytorch/csrc/extensions/activation.cpp similarity index 100% rename from transformer_engine/pytorch/csrc/extensions/activation.cu rename to transformer_engine/pytorch/csrc/extensions/activation.cpp diff --git a/transformer_engine/pytorch/csrc/extensions/apply_rope.cu b/transformer_engine/pytorch/csrc/extensions/apply_rope.cpp similarity index 100% rename from transformer_engine/pytorch/csrc/extensions/apply_rope.cu rename to transformer_engine/pytorch/csrc/extensions/apply_rope.cpp diff --git a/transformer_engine/pytorch/csrc/extensions/cast.cu b/transformer_engine/pytorch/csrc/extensions/cast.cpp similarity index 100% rename from transformer_engine/pytorch/csrc/extensions/cast.cu rename to transformer_engine/pytorch/csrc/extensions/cast.cpp diff --git a/transformer_engine/pytorch/csrc/extensions/gemm.cu b/transformer_engine/pytorch/csrc/extensions/gemm.cpp similarity index 100% rename from transformer_engine/pytorch/csrc/extensions/gemm.cu rename to transformer_engine/pytorch/csrc/extensions/gemm.cpp diff --git a/transformer_engine/pytorch/csrc/extensions/misc.cu b/transformer_engine/pytorch/csrc/extensions/misc.cpp similarity index 100% rename from transformer_engine/pytorch/csrc/extensions/misc.cu rename to transformer_engine/pytorch/csrc/extensions/misc.cpp diff --git a/transformer_engine/pytorch/csrc/extensions/normalization.cu b/transformer_engine/pytorch/csrc/extensions/normalization.cpp similarity index 100% rename from transformer_engine/pytorch/csrc/extensions/normalization.cu rename to transformer_engine/pytorch/csrc/extensions/normalization.cpp diff --git a/transformer_engine/pytorch/csrc/extensions/padding.cu b/transformer_engine/pytorch/csrc/extensions/padding.cpp similarity index 100% rename from transformer_engine/pytorch/csrc/extensions/padding.cu rename to transformer_engine/pytorch/csrc/extensions/padding.cpp diff --git a/transformer_engine/pytorch/csrc/extensions/recipe.cu b/transformer_engine/pytorch/csrc/extensions/recipe.cpp similarity index 100% rename from transformer_engine/pytorch/csrc/extensions/recipe.cu rename to transformer_engine/pytorch/csrc/extensions/recipe.cpp diff --git a/transformer_engine/pytorch/csrc/extensions/softmax.cu b/transformer_engine/pytorch/csrc/extensions/softmax.cpp similarity index 100% rename from transformer_engine/pytorch/csrc/extensions/softmax.cu rename to transformer_engine/pytorch/csrc/extensions/softmax.cpp diff --git a/transformer_engine/pytorch/csrc/extensions/transpose.cu b/transformer_engine/pytorch/csrc/extensions/transpose.cpp similarity index 100% rename from transformer_engine/pytorch/csrc/extensions/transpose.cu rename to transformer_engine/pytorch/csrc/extensions/transpose.cpp