GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — cuda: serialise constant-memory uploads with their kernel launches by melonakos · Pull Request #3725 · arrayfire/arrayfire

Conversation

@melonakos

@melonakos melonakos commented Sep 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Calling af::convolve from several host threads on the CUDA backend can silently return results computed with another thread's filter (#3711). convolve, morph and transform stage per-call data through a constant symbol of a cached module, and the upload and the launch are both asynchronous on the single stream every host thread shares, so two threads can interleave upload, upload, launch, launch. A lock is now held from the upload through the launch enqueue at all seven sites and released before the post-launch check, which synchronises the stream in debug builds and with synchronous calls enabled. Adds a threading test with a distinct filter per thread at the file's usual 32 threads and 1000 iterations.

Draft because there is no NVIDIA GPU here: the backend compiles under CUDA 13 apart from the master breakages #3715 fixes, and the test passes on the CPU backend, but it has not been seen to fail on the unfixed CUDA code. canny and floodFill keep a per-call flag in a device variable and have the same class of bug; not covered here, noted in the mutex comment, and to be filed separately.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
melonakos added 2 commits September 10, 2026 22:34
@melonakos
cuda: serialise constant-memory uploads with their kernel launches
c4d29b9
convolve, morph and transform stage per-call data through a __constant__ symbol of a cached module, and both the upload and the launch are asynchronous on the one stream shared by every host thread. Two threads could interleave upload, upload, launch, launch and the first launch ran with the second thread's filter, silently. Hold a lock from the upload through the launch enqueue at all seven sites, and add a threading test that runs a distinct filter per thread. Fixes #3711.
@melonakos
Release the constant-memory lock before the post-launch check
a6739f6
POST_LAUNCH_CHECK synchronises the stream in debug builds and whenever
synchronous calls are enabled, so the guard now ends before it. The
threading test uses the file's THREAD_COUNT and ITERATION_COUNT, the kernel
headers include platform.hpp for the declaration, and the mutex comment says
that the per-call flags in canny and flood_fill are not covered.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@melonakos
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.