Skip to content

[schur-complement] validate the arguments and report allocation and launch failures - #316

Open
zjin-lcf wants to merge 4 commits into
masterfrom
schur-complement
Open

[schur-complement] validate the arguments and report allocation and launch failures#316
zjin-lcf wants to merge 4 commits into
masterfrom
schur-complement

Conversation

@zjin-lcf

@zjin-lcf zjin-lcf commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

The examples themselves are now on master, so what is left here is the hardening of the four schur-complement-* versions. Merged master to resolve the conflicts, keeping master's Makefiles (LAUNCHER, ARCH, SM and CUDA_ARCH/HIP_ARCH overridable from the environment).

Summary of the changes:

  • Validate <rows>, <nnz per row> and <repeat>. The CSR row pointers and column indices are 32-bit, as in HiOp, so reject non-positive values, a nonzero count that would not fit an int, and row counts for which m + 1 or rounding m up to the block size would overflow. The check lives in reference.h (valid_problem_size) so the four versions cannot drift apart.
  • Report a failed host allocation instead of terminating on bad_alloc, and a failed device allocation in the SYCL version instead of dereferencing a null pointer inside the kernel.
  • Check the CUDA and HIP kernel launches, so an invalid launch configuration is reported instead of showing up as a verification failure.
  • Give the OpenMP kernels 256 threads per team, matching the 32x8 work-group of the CUDA, HIP and SYCL versions, and hoist the SYCL work-group extents into BLOCK_X/BLOCK_Y as in the other versions.
  • Fix the two SYCL kernel comments that still described the original HiOp one-work-item-per-row mapping.

Verified with ./main 1024 32 20 (all PASS): CUDA on a Tesla M40, HIP and OpenMP (AOMP) on an MI100, and SYCL on the M40 through the CUDA backend; the SYCL version also compiles with icpx. Invalid arguments (zero, negative, and out-of-range sizes) are rejected with exit status 1.

zjin-lcf and others added 4 commits August 9, 2026 10:36
…SYCL and OpenMP kernel launches

The CSR row pointers and column indices are 32-bit, so reject non-positive
sizes and sizes whose nonzero count would overflow an int instead of silently
generating a corrupt matrix. Also share the block size macros in the SYCL
version and set the team size explicitly in the OpenMP version.

Co-authored-by: Cursor <cursoragent@cursor.com>
The examples themselves are already on master, so keep only the argument
validation and the kernel-launch alignment here, and take the updated
Makefiles (LAUNCHER, ARCH and SM overridable from the environment) from
master.

Co-authored-by: Cursor <cursoragent@cursor.com>
…n and launch failures

- Move the command-line checks into reference.h so the four versions cannot
  drift apart, and bound the number of rows as well: m + 1 row pointers and
  rounding m up to the block size have to stay within an int.
- Report a failed host allocation instead of terminating on bad_alloc, and a
  failed device allocation in the SYCL version instead of dereferencing null
  in the kernel.
- Check the CUDA and HIP kernel launches, so an invalid launch configuration
  is reported rather than showing up as a verification failure.
- Fix the two SYCL kernel comments that still described the original HiOp
  one-work-item-per-row mapping.

Co-authored-by: Cursor <cursoragent@cursor.com>
@zjin-lcf zjin-lcf changed the title [schur-complement] add the examples [schur-complement] validate the arguments and report allocation and launch failures Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant