Skip to content

Commit

Permalink
Implement frozen_logical_data::get_access_mode to query the access mo…
Browse files Browse the repository at this point in the history
…de used to (#3646)

freeze a logical data (and avoid storing this information separately)
  • Loading branch information
caugonnet authored Feb 3, 2025
1 parent 660b6a8 commit 711ee01
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ private:
ld.set_automatic_unfreeze(fake_task, flag);
}

access_mode get_access_mode() const
{
return m;
}

private:
logical_data<T> ld;
access_mode m;
Expand Down Expand Up @@ -199,6 +204,12 @@ public:
return *this;
}

access_mode get_access_mode() const
{
assert(pimpl);
return pimpl->get_access_mode();
}

private:
::std::shared_ptr<impl> pimpl = nullptr;
};
Expand Down
3 changes: 3 additions & 0 deletions cudax/test/stf/freeze/freeze_rw.cu
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ int main()
for (int k = 0; k < 4; k++)
{
auto fx = ctx.freeze(lX, access_mode::rw, data_place::current_device());

_CCCL_ASSERT(fx.get_access_mode() == access_mode::rw, "invalid access mode");

auto dX = fx.get(data_place::current_device(), stream);
mult<<<8, 4, 0, stream>>>(dX, 4);
fx.unfreeze(stream);
Expand Down
3 changes: 3 additions & 0 deletions docs/cudax/stf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1853,6 +1853,9 @@ stream passed to ``freeze`` (for example, by using a blocking call such as
depend on the completion of the work in the streams used for any preceding
``freeze`` and ``get`` calls.

It is possible to retrieve the access mode used to freeze a logical data with
the ``get_access_mode()`` method of the ``frozen_logical_data`` object.

Logical token
^^^^^^^^^^^^^

Expand Down

0 comments on commit 711ee01

Please sign in to comment.