Skip to content

hsa_signal_silent_store_relaxed should be silent (it's not today) #316

Open
@benvanik

Description

@benvanik

The documentation for hsa_signal_silent_store_relaxed says that it should not wake waiting agents:

Atomically set the value of a signal without necessarily notifying the the agents waiting on it.

The agents waiting on signal may not wake up even when the new value satisfies their wait condition. If the application wants to update the signal and there is no need to notify any agent, invoking this function can be more efficient than calling the non-silent counterpart.

The current implementation, however, always routes the silent calls through to the non-silent ones (hsa_signal_silent_store_relaxed -> hsa_signal_store_relaxed) and those methods call SetEvent(). Though technically correct ("may not wake up") it'd be nice if it didn't try. As the documentation notes a silent operation is useful when there's known to be no waiting agents and the caller wants to avoid potential syscalls. In my particular case I'm initializing known-unused signals in a pool and it'd be nice to be able to use the method intended for that.

The implementation of InterruptSignal today happens to bypass the hsaKmtSetEvent call but unconditionally issues a full seq-cst fence. So it's not as bad as making the syscall but that's relying on an implementation detail that it'd be nice to avoid.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions