Skip to content

Invalidated entries in NativePrograms multimap #14972

@sergey-semenov

Description

@sergey-semenov

Describe the bug

NativePrograms is a UR program -> device binary multimap used to retrieve device image properties for a specific program/kernel. Those entries are never cleaned up, so if a UR program is destroyed and a new one happens to get the same UR handle, the new program will keep the old device binaries in the multimap.

NativePrograms should at least clear existing entries for a UR handle after it's created (since all the old ones are known to belong to a destroyed UR program).

To reproduce

Create a unit-test with two device binaries with the same kernels but different properties. A program is created from the first binary then destroyed, then another one is created from the second binary and ends up having the same UR handle. Check that the correct properties are retrieved for the new program.

Environment

No response

Additional context

Originally, the bug showed up in more cases because NativePrograms used to be an std::unoredered_map. The switch to a multimap got accidentally reverted with PI removal, and the original issue got fixed in #14873 then reverted in #14951

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions