Skip to content

Yohann/support-int-types#187

Merged
lpottier merged 13 commits into
developfrom
yohann/support-int-types
Apr 13, 2026
Merged

Yohann/support-int-types#187
lpottier merged 13 commits into
developfrom
yohann/support-int-types

Conversation

@YohannDudouit
Copy link
Copy Markdown
Collaborator

Add support for int32_t and int64_t as "scalar" types for AMSTensor.
Also fix an unrelated minor bug in eos_ams, where the density was used twice instead of the energy.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Cpp-linter Review

Used clang-format v18.1.8

Click here for the full clang-format patch
diff --git a/src/AMSlib/AMSTensor.cpp b/src/AMSlib/AMSTensor.cpp
index 8362f41..45a41e2 100644
--- a/src/AMSlib/AMSTensor.cpp
+++ b/src/AMSlib/AMSTensor.cpp
@@ -36 +36,2 @@ bool AMSTensor::isContiguous(AMSTensor::IntDimType expected_stride) const
-namespace {
+namespace
+{
@@ -53 +54 @@ constexpr AMSDType scalar_to_ams_dtype()
-}
+}  // namespace
diff --git a/src/AMSlib/wf/interface.cpp b/src/AMSlib/wf/interface.cpp
index b413f26..07a6611 100644
--- a/src/AMSlib/wf/interface.cpp
+++ b/src/AMSlib/wf/interface.cpp
@@ -105 +105,2 @@ static ams::SmallVector<ams::AMSTensor> torchToAMSTensors(
-      throw std::runtime_error("torchToAMSTensors: unsupported tensor scalar type");
+      throw std::runtime_error(
+          "torchToAMSTensors: unsupported tensor scalar type");

Have any feedback or feature suggestions? Share it here.

Comment thread src/AMSlib/AMSTensor.cpp Outdated
Comment thread src/AMSlib/AMSTensor.cpp Outdated
Comment thread src/AMSlib/wf/interface.cpp Outdated
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: Loic Pottier <[email protected]>
Signed-off-by: Loic Pottier <[email protected]>
@lpottier lpottier self-requested a review April 8, 2026 22:50
Copy link
Copy Markdown
Member

@lpottier lpottier left a comment

Choose a reason for hiding this comment

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

LGTM

@YohannDudouit
Copy link
Copy Markdown
Collaborator Author

LGTM

I'm adding tests. Trying to get them in before the meeting :)

@lpottier
Copy link
Copy Markdown
Member

lpottier commented Apr 8, 2026

@YohannDudouit Okay perfect, no rush. I am using your branch to fix AMS CI (on LLNL side) :)

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Cpp-linter Review

Used clang-format v18.1.8

Click here for the full clang-format patch
diff --git a/tests/AMSlib/ams_interface/int_interface.cpp b/tests/AMSlib/ams_interface/int_interface.cpp
index b139f67..d2bf795 100644
--- a/tests/AMSlib/ams_interface/int_interface.cpp
+++ b/tests/AMSlib/ams_interface/int_interface.cpp
@@ -20,3 +20 @@ struct AMSGlobalFixture {
-  AMSGlobalFixture() {
-    AMSInit();
-  }
+  AMSGlobalFixture() { AMSInit(); }
@@ -233,2 +231,2 @@ CATCH_TEST_CASE("AMS API: 2D int32_t tensor execution", "[ams][api][int32][2d]")
-    AMSCAbstrModel model = AMSRegisterAbstractModel(
-        "int32_2d_test", 1.0, "", false);
+    AMSCAbstrModel model =
+        AMSRegisterAbstractModel("int32_2d_test", 1.0, "", false);
@@ -309,2 +307,2 @@ CATCH_TEST_CASE("AMS API: Mixed type tensors", "[ams][api][mixed]")
-    AMSCAbstrModel model = AMSRegisterAbstractModel(
-        "mixed_test", 1.0, "", false);
+    AMSCAbstrModel model =
+        AMSRegisterAbstractModel("mixed_test", 1.0, "", false);
diff --git a/tests/AMSlib/wf/int_tensors.cpp b/tests/AMSlib/wf/int_tensors.cpp
index 608d599..3377bce 100644
--- a/tests/AMSlib/wf/int_tensors.cpp
+++ b/tests/AMSlib/wf/int_tensors.cpp
@@ -25 +25,2 @@ CATCH_TEST_CASE("AMSTensor: int32_t tensor creation and basic properties",
-  const auto device = GENERATE(AMSResourceType::AMS_HOST, AMSResourceType::AMS_DEVICE);
+  const auto device =
+      GENERATE(AMSResourceType::AMS_HOST, AMSResourceType::AMS_DEVICE);
@@ -83 +84,2 @@ CATCH_TEST_CASE("AMSTensor: int64_t tensor creation and basic properties",
-  const auto device = GENERATE(AMSResourceType::AMS_HOST, AMSResourceType::AMS_DEVICE);
+  const auto device =
+      GENERATE(AMSResourceType::AMS_HOST, AMSResourceType::AMS_DEVICE);
@@ -118 +120,2 @@ CATCH_TEST_CASE("AMSTensor: int64_t tensor creation and basic properties",
-CATCH_TEST_CASE("AMSTensor: int32_t tensor view operations", "[ams][tensor][int32][view]")
+CATCH_TEST_CASE("AMSTensor: int32_t tensor view operations",
+                "[ams][tensor][int32][view]")
@@ -130 +133,2 @@ CATCH_TEST_CASE("AMSTensor: int32_t tensor view operations", "[ams][tensor][int3
-    auto tensor_view = AMSTensor::view<int32_t>(data.data(), shape, strides, device);
+    auto tensor_view =
+        AMSTensor::view<int32_t>(data.data(), shape, strides, device);
@@ -149 +153,2 @@ CATCH_TEST_CASE("AMSTensor: int32_t tensor view operations", "[ams][tensor][int3
-    auto tensor_view = AMSTensor::view<int32_t>(data.data(), shape, strides, device);
+    auto tensor_view =
+        AMSTensor::view<int32_t>(data.data(), shape, strides, device);
@@ -162 +167,2 @@ CATCH_TEST_CASE("AMSTensor: int32_t tensor view operations", "[ams][tensor][int3
-CATCH_TEST_CASE("AMSTensor: int64_t tensor view operations", "[ams][tensor][int64][view]")
+CATCH_TEST_CASE("AMSTensor: int64_t tensor view operations",
+                "[ams][tensor][int64][view]")
@@ -174 +180,2 @@ CATCH_TEST_CASE("AMSTensor: int64_t tensor view operations", "[ams][tensor][int6
-    auto tensor_view = AMSTensor::view<int64_t>(data.data(), shape, strides, device);
+    auto tensor_view =
+        AMSTensor::view<int64_t>(data.data(), shape, strides, device);
@@ -185 +192,2 @@ CATCH_TEST_CASE("AMSTensor: int64_t tensor view operations", "[ams][tensor][int6
-CATCH_TEST_CASE("AMSTensor: int tensor transpose operations", "[ams][tensor][transpose]")
+CATCH_TEST_CASE("AMSTensor: int tensor transpose operations",
+                "[ams][tensor][transpose]")
@@ -259 +267,2 @@ CATCH_TEST_CASE("AMSTensor: int tensor move semantics", "[ams][tensor][move]")
-CATCH_TEST_CASE("AMSTensor: dtype_to_size utility for int types", "[ams][utils]")
+CATCH_TEST_CASE("AMSTensor: dtype_to_size utility for int types",
+                "[ams][utils]")
@@ -282 +291 @@ CATCH_TEST_CASE("AMSTensor: dtype_to_size utility for int types", "[ams][utils]"
-    CATCH_REQUIRE(size_int32 == size_float);  // Both 4 bytes
+    CATCH_REQUIRE(size_int32 == size_float);   // Both 4 bytes
@@ -288 +297,2 @@ CATCH_TEST_CASE("AMSTensor: dtype_to_size utility for int types", "[ams][utils]"
-CATCH_TEST_CASE("AMSTensor: SmallVector of int tensors", "[ams][tensor][smallvector]")
+CATCH_TEST_CASE("AMSTensor: SmallVector of int tensors",
+                "[ams][tensor][smallvector]")

Have any feedback or feature suggestions? Share it here.

Comment thread tests/AMSlib/ams_interface/int_interface.cpp Outdated
Comment thread tests/AMSlib/ams_interface/int_interface.cpp Outdated
Comment thread tests/AMSlib/ams_interface/int_interface.cpp Outdated
Comment thread tests/AMSlib/wf/int_tensors.cpp Outdated
Comment thread tests/AMSlib/wf/int_tensors.cpp Outdated
Comment thread tests/AMSlib/wf/int_tensors.cpp Outdated
Comment thread tests/AMSlib/wf/int_tensors.cpp Outdated
Comment thread tests/AMSlib/wf/int_tensors.cpp Outdated
Comment thread tests/AMSlib/wf/int_tensors.cpp Outdated
Comment thread tests/AMSlib/wf/int_tensors.cpp Outdated
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Cpp-linter Review

Used clang-format v18.1.8

Click here for the full clang-format patch
diff --git a/tests/AMSlib/ams_interface/int_interface.cpp b/tests/AMSlib/ams_interface/int_interface.cpp
index 7defa67..d2bf795 100644
--- a/tests/AMSlib/ams_interface/int_interface.cpp
+++ b/tests/AMSlib/ams_interface/int_interface.cpp
@@ -231,2 +231,2 @@ CATCH_TEST_CASE("AMS API: 2D int32_t tensor execution", "[ams][api][int32][2d]")
-    AMSCAbstrModel model = AMSRegisterAbstractModel(
-        "int32_2d_test", 1.0, "", false);
+    AMSCAbstrModel model =
+        AMSRegisterAbstractModel("int32_2d_test", 1.0, "", false);
@@ -307,2 +307,2 @@ CATCH_TEST_CASE("AMS API: Mixed type tensors", "[ams][api][mixed]")
-    AMSCAbstrModel model = AMSRegisterAbstractModel(
-        "mixed_test", 1.0, "", false);
+    AMSCAbstrModel model =
+        AMSRegisterAbstractModel("mixed_test", 1.0, "", false);
diff --git a/tests/AMSlib/wf/int_tensors.cpp b/tests/AMSlib/wf/int_tensors.cpp
index 608d599..3377bce 100644
--- a/tests/AMSlib/wf/int_tensors.cpp
+++ b/tests/AMSlib/wf/int_tensors.cpp
@@ -25 +25,2 @@ CATCH_TEST_CASE("AMSTensor: int32_t tensor creation and basic properties",
-  const auto device = GENERATE(AMSResourceType::AMS_HOST, AMSResourceType::AMS_DEVICE);
+  const auto device =
+      GENERATE(AMSResourceType::AMS_HOST, AMSResourceType::AMS_DEVICE);
@@ -83 +84,2 @@ CATCH_TEST_CASE("AMSTensor: int64_t tensor creation and basic properties",
-  const auto device = GENERATE(AMSResourceType::AMS_HOST, AMSResourceType::AMS_DEVICE);
+  const auto device =
+      GENERATE(AMSResourceType::AMS_HOST, AMSResourceType::AMS_DEVICE);
@@ -118 +120,2 @@ CATCH_TEST_CASE("AMSTensor: int64_t tensor creation and basic properties",
-CATCH_TEST_CASE("AMSTensor: int32_t tensor view operations", "[ams][tensor][int32][view]")
+CATCH_TEST_CASE("AMSTensor: int32_t tensor view operations",
+                "[ams][tensor][int32][view]")
@@ -130 +133,2 @@ CATCH_TEST_CASE("AMSTensor: int32_t tensor view operations", "[ams][tensor][int3
-    auto tensor_view = AMSTensor::view<int32_t>(data.data(), shape, strides, device);
+    auto tensor_view =
+        AMSTensor::view<int32_t>(data.data(), shape, strides, device);
@@ -149 +153,2 @@ CATCH_TEST_CASE("AMSTensor: int32_t tensor view operations", "[ams][tensor][int3
-    auto tensor_view = AMSTensor::view<int32_t>(data.data(), shape, strides, device);
+    auto tensor_view =
+        AMSTensor::view<int32_t>(data.data(), shape, strides, device);
@@ -162 +167,2 @@ CATCH_TEST_CASE("AMSTensor: int32_t tensor view operations", "[ams][tensor][int3
-CATCH_TEST_CASE("AMSTensor: int64_t tensor view operations", "[ams][tensor][int64][view]")
+CATCH_TEST_CASE("AMSTensor: int64_t tensor view operations",
+                "[ams][tensor][int64][view]")
@@ -174 +180,2 @@ CATCH_TEST_CASE("AMSTensor: int64_t tensor view operations", "[ams][tensor][int6
-    auto tensor_view = AMSTensor::view<int64_t>(data.data(), shape, strides, device);
+    auto tensor_view =
+        AMSTensor::view<int64_t>(data.data(), shape, strides, device);
@@ -185 +192,2 @@ CATCH_TEST_CASE("AMSTensor: int64_t tensor view operations", "[ams][tensor][int6
-CATCH_TEST_CASE("AMSTensor: int tensor transpose operations", "[ams][tensor][transpose]")
+CATCH_TEST_CASE("AMSTensor: int tensor transpose operations",
+                "[ams][tensor][transpose]")
@@ -259 +267,2 @@ CATCH_TEST_CASE("AMSTensor: int tensor move semantics", "[ams][tensor][move]")
-CATCH_TEST_CASE("AMSTensor: dtype_to_size utility for int types", "[ams][utils]")
+CATCH_TEST_CASE("AMSTensor: dtype_to_size utility for int types",
+                "[ams][utils]")
@@ -282 +291 @@ CATCH_TEST_CASE("AMSTensor: dtype_to_size utility for int types", "[ams][utils]"
-    CATCH_REQUIRE(size_int32 == size_float);  // Both 4 bytes
+    CATCH_REQUIRE(size_int32 == size_float);   // Both 4 bytes
@@ -288 +297,2 @@ CATCH_TEST_CASE("AMSTensor: dtype_to_size utility for int types", "[ams][utils]"
-CATCH_TEST_CASE("AMSTensor: SmallVector of int tensors", "[ams][tensor][smallvector]")
+CATCH_TEST_CASE("AMSTensor: SmallVector of int tensors",
+                "[ams][tensor][smallvector]")

Have any feedback or feature suggestions? Share it here.

Comment thread tests/AMSlib/ams_interface/int_interface.cpp
Comment thread tests/AMSlib/ams_interface/int_interface.cpp
Comment thread tests/AMSlib/wf/int_tensors.cpp
Comment thread tests/AMSlib/wf/int_tensors.cpp
Comment thread tests/AMSlib/wf/int_tensors.cpp
Comment thread tests/AMSlib/wf/int_tensors.cpp
Comment thread tests/AMSlib/wf/int_tensors.cpp
Comment thread tests/AMSlib/wf/int_tensors.cpp
Comment thread tests/AMSlib/wf/int_tensors.cpp
Comment thread tests/AMSlib/wf/int_tensors.cpp
Comment thread tests/AMSlib/wf/CMakeLists.txt Outdated
Comment thread tests/AMSlib/ams_interface/CMakeLists.txt Outdated
@lpottier lpottier merged commit e1357a0 into develop Apr 13, 2026
20 checks passed
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.

2 participants