Page MenuHomePhabricator

[Acxxel] Remove setActiveDeviceForThread
ClosedPublic

Authored by jhen on Oct 27 2016, 4:51 PM.

Details

Summary

After experimenting with CUDA, I realized that we really only need to
set the active context right before creating an object such as a stream
or a device memory allocation. When we go on to use these objects later,
it is fine if the context that created them is no longer active,
operations with those objects will succeed anyway.

Since it turns out that we don't have to check the active context for
every operation, it makes sense to hide this active context from users
(by removing the "ActiveDeviceForThread" setter and getter) and to
change the Acxxel API to explicitly pass in the device ID to create
objects.

This change improves the Acxxel API and greatly simplifies the CUDA and
OpenCL implementations because they no longer require thread_local data.

Diff Detail

Repository
rL LLVM

Event Timeline

jhen updated this revision to Diff 76133.Oct 27 2016, 4:51 PM
jhen retitled this revision from to [Acxxel] Remove setActiveDeviceForThread.
jhen updated this object.
jhen added reviewers: jlebar, jprice.
jhen added a subscriber: parallel_libs-commits.
jlebar accepted this revision.Oct 27 2016, 5:14 PM
jlebar edited edge metadata.

Well this is great news.

acxxel/acxxel.h
502 ↗(On Diff #76133)

Is there a reason we don't default DeviceIndex here as we do elsewhere, or is that just an oversight?

This revision is now accepted and ready to land.Oct 27 2016, 5:14 PM
jhen updated this revision to Diff 76144.Oct 27 2016, 5:25 PM
jhen edited edge metadata.
  • Default DeviceIndex for getSymbolMemory
jhen marked an inline comment as done.Oct 27 2016, 5:25 PM
jhen added inline comments.
acxxel/acxxel.h
502 ↗(On Diff #76133)

Oops, I accidentally missed that one. Thanks for catching it!

This revision was automatically updated to reflect the committed changes.
jhen marked an inline comment as done.