Skip to content

Commit e4efdc3

Browse files
author
Felix Igelbrink
committed
ensure actual alignment
1 parent 155aec5 commit e4efdc3

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

optix/module.pyx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,19 @@ cdef class Module(OptixContextObject):
237237
src,
238238
ModuleCompileOptions module_compile_options = ModuleCompileOptions(),
239239
PipelineCompileOptions pipeline_compile_options = PipelineCompileOptions(),
240-
compile_flags=_nvrtc_compile_flags_default,
240+
compile_flags=None,
241241
program_name=None):
242242
super().__init__(context)
243243
cdef const char * c_ptx
244244
cdef unsigned int pipeline_payload_values, i
245+
246+
if compile_flags is None:
247+
compile_flags = _nvrtc_compile_flags_default
248+
245249
self._compile_flags = list(compile_flags)
246250

251+
if module_compile_options.debug_level != CompileDebugLevel.NONE:
252+
self._compile_flags.append("-G")
247253
if src is not None:
248254
ptx = self.compile_cuda_ptx(src, compile_flags, name=program_name)
249255
c_ptx = ptx
@@ -378,6 +384,10 @@ cdef class Module(OptixContextObject):
378384
&builtin_is_options.options, &module.module))
379385
return module
380386

387+
@staticmethod
388+
def get_default_nvrtc_compile_flags(std=None, rdc=False):
389+
return get_default_nvrtc_compile_flags(std, rdc)
390+
381391
@staticmethod
382392
def compile_cuda_ptx(src, compile_flags=_nvrtc_compile_flags_default, name=None, **kwargs):
383393
if os.path.exists(src):

optix/struct.pyx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ def _aligned_itemsize( formats, alignment ):
1818
temp_dtype = np.dtype( {
1919
'names' : names,
2020
'formats' : formats,
21-
'align' : True
22-
} )
21+
}, align=True)
2322
return round_up( temp_dtype.itemsize, alignment )
2423

2524
def array_to_device_memory(numpy_array, stream=None):
@@ -175,9 +174,8 @@ cdef class _StructHelper:
175174
'names': names,
176175
'formats': formats,
177176
'itemsize': itemsize,
178-
'align': True
179-
})
180-
177+
}, align=True)
178+
assert dtype.isalignedstruct
181179
return dtype
182180

183181
def _prepare_array(self, array):

0 commit comments

Comments
 (0)