Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions backends/apple/mps/runtime/MPSDevice.mm
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ static inline MTLLanguageVersion getMetalLanguageVersion(const id<MTLDevice>& de
// MPS Advanced Indexing needs at least Metal 2.0 (support for Argument Buffers and function constants)
// host_name attribute needs at least Metal 2.2 and ulong needs Metal 2.3 (supported on MacOS 11+)
MTLLanguageVersion languageVersion = MTLLanguageVersion2_3;
#if defined(__MAC_13_0)
if (macOS13Plus) {
languageVersion = MTLLanguageVersion3_0;
if (@available(iOS 16, macOS 13, *)) {
if (macOS13Plus) {
languageVersion = MTLLanguageVersion3_0;
}
}
#endif

ET_CHECK_MSG([device supportsFamily:MTLGPUFamilyMac2], "Missing Metal support for MTLGPUFamilyMac2");
return languageVersion;
Expand Down
38 changes: 21 additions & 17 deletions backends/apple/mps/runtime/operations/IndexingOps.mm
Original file line number Diff line number Diff line change
Expand Up @@ -206,25 +206,29 @@

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 16, macOS 13, *)) {
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 {
return Error::NotSupported;
}
}


Expand Down
Loading