truncate unsigned const in cstyle (#11318)

it can be a warning or a hard error in clang

PTX and PYTHON also need fix, skipping for now
This commit is contained in:
chenyu
2025-07-22 08:02:12 -04:00
committed by GitHub
parent 6668d6d241
commit a41140241b
2 changed files with 11 additions and 3 deletions

View File

@@ -96,6 +96,14 @@ class TestDType(unittest.TestCase):
get_available_cast_dtypes(self.DTYPE)
))
@unittest.skipIf(Device.DEFAULT == "PYTHON", "skip for now")
@unittest.skipIf(getenv("PTX"), "skip for now")
def test_uint_overflow(self):
if not dtypes.is_unsigned(self.DTYPE): raise unittest.SkipTest("only for unsigned")
v = dtypes.max(self.DTYPE)
_test_to_np(Tensor(v, dtype=self.DTYPE)+2, _to_np_dtype(self.DTYPE), np.array(v, dtype=_to_np_dtype(self.DTYPE))+2)
_test_to_np(Tensor(v, dtype=self.DTYPE)*2, _to_np_dtype(self.DTYPE), np.array(v, dtype=_to_np_dtype(self.DTYPE))*2)
def test_dtypes_fields(self):
fields = dtypes.fields()
self.assertIn("float", fields)