-
Notifications
You must be signed in to change notification settings - Fork 531
Support MPS Backend also on iOS < 16 (#9089) #9095
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -206,25 +206,32 @@ | |
|
||
Error | ||
MPSGraphBuilder::mpsScatterOp(NodePtr nodePtr) { | ||
auto graphNode = nodePtr->mpsnode_union_as_MPSScatter(); | ||
ET_LOG( | ||
Debug, "%s %d: %d", | ||
__FUNCTION__, graphNode->input1_id(), graphNode->output_id() | ||
); | ||
if (@available(iOS 15.4, macOS 12.3, *)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good catch |
||
auto graphNode = nodePtr->mpsnode_union_as_MPSScatter(); | ||
ET_LOG( | ||
Debug, "%s %d: %d", | ||
__FUNCTION__, graphNode->input1_id(), graphNode->output_id() | ||
); | ||
|
||
int64_t dim = graphNode->dim(); | ||
MPSGraphTensor* inputTensor = getMPSGraphTensor(graphNode->input1_id()); | ||
MPSGraphTensor* indicesTensor = getMPSGraphTensor(graphNode->idx_id()); | ||
MPSGraphTensor* updatesTensor = getMPSGraphTensor(graphNode->src_id()); | ||
int64_t dim = graphNode->dim(); | ||
MPSGraphTensor* inputTensor = getMPSGraphTensor(graphNode->input1_id()); | ||
MPSGraphTensor* indicesTensor = getMPSGraphTensor(graphNode->idx_id()); | ||
MPSGraphTensor* updatesTensor = getMPSGraphTensor(graphNode->src_id()); | ||
|
||
_idToMPSGraphTensor[graphNode->output_id()] = | ||
[_mpsGraph scatterAlongAxis:dim | ||
withDataTensor:inputTensor | ||
updatesTensor:updatesTensor | ||
indicesTensor:indicesTensor | ||
mode:MPSGraphScatterModeSet | ||
name:nil]; | ||
return Error::Ok; | ||
_idToMPSGraphTensor[graphNode->output_id()] = | ||
[_mpsGraph scatterAlongAxis:dim | ||
withDataTensor:inputTensor | ||
updatesTensor:updatesTensor | ||
indicesTensor:indicesTensor | ||
mode:MPSGraphScatterModeSet | ||
name:nil]; | ||
|
||
return Error::Ok; | ||
} else { | ||
ET_LOG(Error, "MPS: scatter op is not supported on iOS < 15.4 and macOS < 12.3"); | ||
|
||
return Error::NotSupported; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, one minor thing - can you add an error log here like
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added, and I also changed the requirements to iOS 15.4 and MacOS 12.3 |
||
} | ||
} | ||
|
||
|
||
|
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.
Thank you for the change