-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add partial support for withDevice(.deviceType) {} #20897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great progress! Left some comments on code structure.
9b669e3
to
cb428ef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm very excited to see us heading in this direction!
Left a few comments, and I also have some design level questions. Will sync up with you today. Thanks!
@_silgen_name("_swift_tfc_OpSetDeviceFromScope") | ||
func _TFCOpSetDeviceFromScope(_ op: CTFEOp, _ status: CTFStatus) { | ||
let context = _ExecutionContext.global | ||
let device = context.sync { context.deviceScopes.last ?? .`default` }.opSetDeviceFromScope(op, status) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
context.deviceScopes.last ?? .
default
Given we initialized deviceScopes
with a root element (be it .cpu
, or .default
as i suggested above), should we instead assert that context.deviceScopes.last
is never 'nil
?
@swift-ci please test tensorflow |
@swift-ci please test tensorflow |
@swift-ci please test tensorflow macos |
@swift-ci please test tensorflow |
@swift-ci please test tensorflow |
…ger op dispatch. Unfortunately, this info gets ignored when any ops get extracted out into a graph, but hopefully static analysis of these calls could remove some of those differences.
@swift-ci please test tensorflow |
1 similar comment
@swift-ci please test tensorflow |
Add a deviceScopes stack to CompilerRuntime to be consulted by the eager op dispatch.
Unfortunately, this info gets ignored when any ops get extracted out into a
graph, but hopefully static analysis of these calls could remove some of those differences.