feat: track current runtime device in dispatch#17
Closed
spike-zhu wants to merge 1 commit into
Closed
Conversation
Collaborator
|
为啥 dispatch 层需要维护设备号?这个是哪里出问题了嘛,还是什么事情需要这个。因为目前的设计就是 |
Contributor
Author
感谢嘉成指出,是这样的,已关闭 PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
本次修改的目的是让 InfiniRT runtime dispatch 层维护完整的当前设备状态。
原先 dispatch 层只记录
Device::Type,只能区分当前使用的是 CPU、NVIDIA 等后端类型,无法记录具体的 device index。这样在多卡后端场景下,SetDevice(1)虽然会调用到底层 runtime,但 dispatch 层自身并不知道当前设备已经切换到 index 1。本次修改将 thread-local 状态从
Device::Type调整为完整的Device{type, index},并在SetDevice/GetDevice成功后同步更新当前 device index,使 dispatch 层状态与底层 runtime 状态保持一致。