Skip to content
Snippets Groups Projects
Commit d8ae9002 authored by Richard Angersbach's avatar Richard Angersbach
Browse files

Use predefined macro values for numeric limits in cuda backend

parent f60d9d5d
No related branches found
No related tags found
1 merge request!438Reduction Support
......@@ -65,7 +65,7 @@ class CudaPlatform(GenericGpu):
@property
def required_headers(self) -> set[str]:
return {'"gpu_defines.h"', "<cuda/std/limits>"}
return {'"gpu_defines.h"'}
def materialize_iteration_space(
self, body: PsBlock, ispace: IterationSpace
......@@ -85,8 +85,11 @@ class CudaPlatform(GenericGpu):
arg_types = (dtype,) * func.num_args
if isinstance(dtype, PsScalarType) and func in (NumericLimitsFunctions.Min, NumericLimitsFunctions.Max):
assert isinstance(dtype, PsIeeeFloatType)
defines = { NumericLimitsFunctions.Min: "NEG_INFINITY", NumericLimitsFunctions.Max: "POS_INFINITY" }
return PsLiteralExpr(
PsLiteral(f"::cuda::std::numeric_limits<{dtype.c_string()}>::{func.function_name}()", dtype))
PsLiteral(defines[func.function_name], dtype))
if isinstance(dtype, PsIeeeFloatType):
match func:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment