Skip to content

[FEA] Invalidate get_size() after user calls get_device_mutable_view() #39

Closed

Description

@jrhemstad

Is your feature request related to a problem? Please describe.

The value of static_map::get_size() is only guaranteed to be correct if a user goes through the bulk static_map::insert API. I

If instead a user calls get_device_mutable_view(), then there it is likely that the user inserted keys into the map, but there is no way for us to know how many keys were inserted. Therefore, the value of static_map::get_size() is no longer valid.

Describe the solution you'd like

Invalidate the value of static_map::get_size() whenever a user calls static_map::get_device_mutable_view(). Likewise, provide a static_map::set_size() API for the user to tell us how many keys they inserted (their responsibility to make sure it is accurate).

We can do two things after static_map::get_size() has been invalidated:

  1. Throw an exception stating that get_size() cannot be called after get_mutable_device_view() unless set_size() has been called.
  2. Launch a kernel to recompute the size.

Option 2. would be more convenient, but a potential performance pitfall. Option 1 requires more user effort, but less of a chance of a performance pitfall.

Activity

  1. added
    type: feature request
    topic: static_map
    on Sep 17, 2020
  2. aabbas90 commented on Jul 4, 2023

    @aabbas90

    After much time of debugging I found this issue. For visibility, it would be great if atleast in the documentation of get_size it is mentioned that the size is invalid for device operations. Thanks!

  3. PointKernel commented on Dec 11, 2024

    @PointKernel
    Member

    Closing this as we always recompute the size when invoking size() in the new implementation

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: static_maptype: feature request

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions