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

update tests to include offset and byte size for cuda #7202

Merged
merged 2 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
57 changes: 57 additions & 0 deletions qa/L0_cuda_shared_memory/cuda_shared_memory_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,63 @@ def test_register_out_of_bound(self):
register_byte_size=create_byte_size + 1,
)

def test_infer_offset_out_of_bound(self):
# CUDA Shared memory offset outside output region - Throws error
error_msg = []
shm_handles = self._configure_server()
if self.protocol == "http":
# -32 when placed in an int64 signed type, to get a negative offset
# by overflowing
offset = 2**64 - 32
else:
# gRPC will throw an error if > 2**63 - 1, so instead test for
# exceeding shm region size by 1 byte, given its size is 64 bytes
offset = 64
iu.shm_basic_infer(
self,
self.triton_client,
shm_handles[0],
shm_handles[1],
shm_handles[2],
shm_handles[3],
error_msg,
shm_output_offset=offset,
protocol=self.protocol,
use_system_shared_memory=False,
use_cuda_shared_memory=True,
)

self.assertEqual(len(error_msg), 1)
self.assertIn("Invalid offset for shared memory region", error_msg[0])
self._cleanup_server(shm_handles)

def test_infer_byte_size_out_of_bound(self):
# Shared memory byte_size outside output region - Throws error
error_msg = []
shm_handles = self._configure_server()
offset = 60
byte_size = self.DEFAULT_SHM_BYTE_SIZE

iu.shm_basic_infer(
self,
self.triton_client,
shm_handles[0],
shm_handles[1],
shm_handles[2],
shm_handles[3],
error_msg,
shm_output_offset=offset,
shm_output_byte_size=byte_size,
protocol=self.protocol,
use_system_shared_memory=False,
use_cuda_shared_memory=True,
)
self.assertEqual(len(error_msg), 1)
self.assertIn(
"Invalid offset + byte size for shared memory region", error_msg[0]
)
self._cleanup_server(shm_handles)


if __name__ == "__main__":
unittest.main()
4 changes: 3 additions & 1 deletion qa/L0_cuda_shared_memory/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ for i in \
test_too_big_shm \
test_mixed_raw_shm \
test_unregisterall \
test_register_out_of_bound; do
test_register_out_of_bound \
test_infer_offset_out_of_bound \
test_infer_byte_size_out_of_bound; do
for client_type in http grpc; do
SERVER_ARGS="--model-repository=`pwd`/models --log-verbose=1"
SERVER_LOG="./$i.$client_type.server.log"
Expand Down
Loading