Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PytatoPyOpenCLArrayContext: don't trust the arg limit reported by the GPU #198

Merged
merged 5 commits into from
Sep 26, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion arraycontext/impl/pytato/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,19 @@ def get_target(self):
self.using_svm and dev.type & cl.device_type.GPU
and cl_char.has_coarse_grain_buffer_svm(dev))):

limit = dev.max_parameter_size
if dev.max_parameter_size == 4352:
inducer marked this conversation as resolved.
Show resolved Hide resolved
# Nvidia devices and PTXAS advertise a limit of 4352 bytes,
# which is incorrect. The CUDA documentation at
# https://docs.nvidia.com/cuda/cuda-c-programming-guide/#function-parameters
# advertises a limit of 4KB, which is also incorrect.
# As far as I can tell, the actual limit is around 4080
# bytes, at least on a K40. Reducing the limit further
# in order ot be on the safe side.

limit = 4096-200
inducer marked this conversation as resolved.
Show resolved Hide resolved
else:
limit = dev.max_parameter_size

if self._force_svm_arg_limit is not None:
limit = self._force_svm_arg_limit

Expand Down