Skip to content

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

Merged
merged 1 commit into from
Dec 8, 2018

Conversation

pschuh
Copy link
Contributor

@pschuh pschuh commented Nov 30, 2018

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.

@pschuh pschuh requested review from rxwei and mhong November 30, 2018 02:04
Copy link
Contributor

@rxwei rxwei left a 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.

@pschuh pschuh force-pushed the 10 branch 2 times, most recently from 9b669e3 to cb428ef Compare November 30, 2018 04:09
Copy link

@mhong mhong left a 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)
Copy link

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?

@pschuh
Copy link
Contributor Author

pschuh commented Nov 30, 2018

@swift-ci please test tensorflow

@pschuh
Copy link
Contributor Author

pschuh commented Dec 7, 2018

@swift-ci please test tensorflow

@pschuh
Copy link
Contributor Author

pschuh commented Dec 7, 2018

@swift-ci please test tensorflow macos

@pschuh
Copy link
Contributor Author

pschuh commented Dec 7, 2018

@swift-ci please test tensorflow

@pschuh
Copy link
Contributor Author

pschuh commented Dec 7, 2018

@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.
@pschuh
Copy link
Contributor Author

pschuh commented Dec 8, 2018

@swift-ci please test tensorflow

1 similar comment
@pschuh
Copy link
Contributor Author

pschuh commented Dec 8, 2018

@swift-ci please test tensorflow

@pschuh pschuh merged commit 78f131b into swiftlang:tensorflow Dec 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants