Skip to content
Snippets Groups Projects
Commit fcd5bfb6 authored by Frederik Hennig's avatar Frederik Hennig
Browse files

Some cleanup to the pystencils runtime headers

parent 1998bc1e
Branches
1 merge request!456Some cleanup to the pystencils runtime headers
......@@ -188,7 +188,7 @@ class CudaPlatform(GenericGpu):
@property
def required_headers(self) -> set[str]:
return {'"gpu_defines.h"'}
return {'"pystencils_runtime/hip.h"'} # TODO: move to HipPlatform once it is introduced
def materialize_iteration_space(
self, body: PsBlock, ispace: IterationSpace
......
#pragma once
extern "C++" {
#ifdef __CUDA_ARCH__
template <typename DTYPE_T, std::size_t DIMENSION> struct PyStencilsField {
DTYPE_T *data;
DTYPE_T shape[DIMENSION];
DTYPE_T stride[DIMENSION];
};
#else
#include <array>
template <typename DTYPE_T, std::size_t DIMENSION> struct PyStencilsField {
DTYPE_T *data;
std::array<DTYPE_T, DIMENSION> shape;
std::array<DTYPE_T, DIMENSION> stride;
};
#endif
}
#pragma once
#define POS_INFINITY __int_as_float(0x7f800000)
#define INFINITY POS_INFINITY
#define NEG_INFINITY __int_as_float(0xff800000)
#ifdef __HIPCC_RTC__
typedef __hip_uint8_t uint8_t;
typedef __hip_int8_t int8_t;
......
......@@ -250,8 +250,8 @@ class CupyJit(JitBase):
headers = self._runtime_headers
headers |= kfunc.required_headers
if '"half_precision.h"' in headers:
headers.remove('"half_precision.h"')
if '"pystencils_runtime/half.h"' in headers:
headers.remove('"pystencils_runtime/half.h"')
if cp.cuda.runtime.is_hip:
headers.add("<hip/hip_fp16.h>")
else:
......
......@@ -661,7 +661,7 @@ class PsIeeeFloatType(PsScalarType):
@property
def required_headers(self) -> set[str]:
if self._width == 16:
return {'"half_precision.h"'}
return {'"pystencils_runtime/half.h"'}
else:
return set()
......@@ -672,7 +672,7 @@ class PsIeeeFloatType(PsScalarType):
match self.width:
case 16:
return f"((half) {value})" # see include/half_precision.h
return f"((half) {value})" # see include/pystencils_runtime/half.h
case 32:
return f"{value}f"
case 64:
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment