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

Out-of-bounds error message often omits or shows incorrect bounds for negative indices. #280

Open
GagaLP opened this issue Sep 4, 2024 · 0 comments
Labels
good first issue Good for newcomers

Comments

@GagaLP
Copy link
Contributor

GagaLP commented Sep 4, 2024

The out-of-bounds (OOB) error message displays incorrect information when the bounds start at [0,0,0] and the access is off by one. For example, I encountered the following error:

[2024-09-04 16:41:12.700] [0] [error] Out-of-bounds access detected in device kernel T4: accessor 1 attempted to access buffer B3 indices between [0,0,0] - [12,41,1] and outside the declared range [0,0,0] - [12,41,1].

While creating a minimal example, I found that the OOB message is sometimes omitted entirely. Here's a sample code snippet that reproduces this issue:

#include <celerity.h>

int main(void) {
	celerity::distr_queue q;

	constexpr size_t size = 256;
	celerity::buffer<float, 2> matrix{{size, size}};

	q.submit([&](celerity::handler& cgh) {
		celerity::accessor matrix_acc{matrix, cgh, celerity::access::one_to_one{}, celerity::write_only, celerity::no_init};
		cgh.parallel_for(celerity::range<2>(size, size), [=](celerity::item<2> item) {
			matrix_acc[{item.get_id(0) - 1, item.get_id(1)}] = 0;
		});
	});


	return EXIT_SUCCESS;
}

When only one index of a 2D accessor is out-of-bounds (specifically when the index is -1), the error message is completely omitted. However, when both indices are out-of-bounds (both set to -1), the following error message appears:

[2024-09-04 17:33:57.485] [0] [error] Out-of-bounds access detected in device kernel T1: accessor 0 attempted to access buffer B0 indicies between [0,0,0] - [255,255,1] and outside the declared range [0,0,0] - [256,256,1].
@psalz psalz added the good first issue Good for newcomers label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants