Function(depthwiseConvolution): missing threadgroupMemory binding at index 0 for lM[0]











up vote
0
down vote

favorite












I'm trying to execute a simple DepthwiseConvolution kernel with Metal Performance Shaders on MacOS and have problems with it. First I initialize an MPSImage (called debugInputImage) with proper size filled with some number, say 1.0. Then I create my convolutional kernel:



convolution_depthwise_0 = MPSCNNConvolution(device: device, 
weights: datasource_depthwise_0)


Where datasource_depthwise_0 is an instance of MPSCNNConvolutionDataSource with the following descriptor:



func descriptor() -> MPSCNNConvolutionDescriptor {
var desc = MPSCNNDepthWiseConvolutionDescriptor(kernelWidth: 3,
kernelHeight: 3,
inputFeatureChannels: 32,
outputFeatureChannels: 32)
return desc
}


This is how I initialise the input image:



let imageDescriptor = MPSImageDescriptor(channelFormat: .float16, 
width: 256, height: 256, featureChannels: 32)

debugInputImage = MPSImage(device: device,
imageDescriptor: imageDescriptor)

var arrayOfOnes = Array(repeating: Float(1.0),
count: imageDescriptor.width * imageDescriptor.height
* imageDescriptor.featureChannels)


let arrayOfOnes16 = toFloat16(&arrayOfOnes, size: arrayOfOnes.count)

debugInputImage.writeBytes(arrayOfOnes16,
dataLayout: MPSDataLayout.HeightxWidthxFeatureChannels, imageIndex: 0)


When I run all of this:



let commandBuffer = commandQueue.makeCommandBuffer()!
let outImage = convolution_depthwise_0.encode(commandBuffer: commandBuffer,
sourceImage: debugInputImage)


And get this error (at this line let outImage = convolution_depthwise_0.encode(...):



validateComputeFunctionArguments:860: failed assertion `Compute 
Function(depthwiseConvolution): missing threadgroupMemory binding
at index 0 for lM[0].'


For regular convolution everything is fine, only for Depthwise I get this problem.



What could be the reason for that error?



System: MacOS 10.14, XCode 10.1 beta 3



Only MPSCNNDepthWiseConvolutionDescriptor doesn't work. I have no problems with MPSCNNConvolutionDescriptor. I also have no problems on iOS, only Mac OS.










share|improve this question




















  • 1




    What OS are you running this on? I've been using depthwise convolutions a lot but haven't come across this error yet (on iOS anyway). It seems like an error in MPS. The only other thing I can think of is that perhaps your MPSImage is in a format not supported by the depthwise convolution.
    – Matthijs Hollemans
    Nov 8 at 10:02










  • @MatthijsHollemans I am running it on MacOS. I have added it to the question. I haven't tried it on IOS yet but probably it's something I have to do.
    – Alexander Ponomarev
    Nov 8 at 10:44






  • 1




    Are your inputFeatureChannels and outputFeatureChannels the same value?
    – Matthijs Hollemans
    Nov 8 at 10:58










  • @MatthijsHollemans yes, they are the same. Updated values in the question. Otherwise (just for example) I get two kind of errors: "multipler not 1 is not supported" or "output should be multiple of input". :) So those errors look easily understandable.
    – Alexander Ponomarev
    Nov 8 at 11:08






  • 1




    Is the validation layer enabled for a playground?
    – Ken Thomases
    Nov 8 at 16:39















up vote
0
down vote

favorite












I'm trying to execute a simple DepthwiseConvolution kernel with Metal Performance Shaders on MacOS and have problems with it. First I initialize an MPSImage (called debugInputImage) with proper size filled with some number, say 1.0. Then I create my convolutional kernel:



convolution_depthwise_0 = MPSCNNConvolution(device: device, 
weights: datasource_depthwise_0)


Where datasource_depthwise_0 is an instance of MPSCNNConvolutionDataSource with the following descriptor:



func descriptor() -> MPSCNNConvolutionDescriptor {
var desc = MPSCNNDepthWiseConvolutionDescriptor(kernelWidth: 3,
kernelHeight: 3,
inputFeatureChannels: 32,
outputFeatureChannels: 32)
return desc
}


This is how I initialise the input image:



let imageDescriptor = MPSImageDescriptor(channelFormat: .float16, 
width: 256, height: 256, featureChannels: 32)

debugInputImage = MPSImage(device: device,
imageDescriptor: imageDescriptor)

var arrayOfOnes = Array(repeating: Float(1.0),
count: imageDescriptor.width * imageDescriptor.height
* imageDescriptor.featureChannels)


let arrayOfOnes16 = toFloat16(&arrayOfOnes, size: arrayOfOnes.count)

debugInputImage.writeBytes(arrayOfOnes16,
dataLayout: MPSDataLayout.HeightxWidthxFeatureChannels, imageIndex: 0)


When I run all of this:



let commandBuffer = commandQueue.makeCommandBuffer()!
let outImage = convolution_depthwise_0.encode(commandBuffer: commandBuffer,
sourceImage: debugInputImage)


And get this error (at this line let outImage = convolution_depthwise_0.encode(...):



validateComputeFunctionArguments:860: failed assertion `Compute 
Function(depthwiseConvolution): missing threadgroupMemory binding
at index 0 for lM[0].'


For regular convolution everything is fine, only for Depthwise I get this problem.



What could be the reason for that error?



System: MacOS 10.14, XCode 10.1 beta 3



Only MPSCNNDepthWiseConvolutionDescriptor doesn't work. I have no problems with MPSCNNConvolutionDescriptor. I also have no problems on iOS, only Mac OS.










share|improve this question




















  • 1




    What OS are you running this on? I've been using depthwise convolutions a lot but haven't come across this error yet (on iOS anyway). It seems like an error in MPS. The only other thing I can think of is that perhaps your MPSImage is in a format not supported by the depthwise convolution.
    – Matthijs Hollemans
    Nov 8 at 10:02










  • @MatthijsHollemans I am running it on MacOS. I have added it to the question. I haven't tried it on IOS yet but probably it's something I have to do.
    – Alexander Ponomarev
    Nov 8 at 10:44






  • 1




    Are your inputFeatureChannels and outputFeatureChannels the same value?
    – Matthijs Hollemans
    Nov 8 at 10:58










  • @MatthijsHollemans yes, they are the same. Updated values in the question. Otherwise (just for example) I get two kind of errors: "multipler not 1 is not supported" or "output should be multiple of input". :) So those errors look easily understandable.
    – Alexander Ponomarev
    Nov 8 at 11:08






  • 1




    Is the validation layer enabled for a playground?
    – Ken Thomases
    Nov 8 at 16:39













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I'm trying to execute a simple DepthwiseConvolution kernel with Metal Performance Shaders on MacOS and have problems with it. First I initialize an MPSImage (called debugInputImage) with proper size filled with some number, say 1.0. Then I create my convolutional kernel:



convolution_depthwise_0 = MPSCNNConvolution(device: device, 
weights: datasource_depthwise_0)


Where datasource_depthwise_0 is an instance of MPSCNNConvolutionDataSource with the following descriptor:



func descriptor() -> MPSCNNConvolutionDescriptor {
var desc = MPSCNNDepthWiseConvolutionDescriptor(kernelWidth: 3,
kernelHeight: 3,
inputFeatureChannels: 32,
outputFeatureChannels: 32)
return desc
}


This is how I initialise the input image:



let imageDescriptor = MPSImageDescriptor(channelFormat: .float16, 
width: 256, height: 256, featureChannels: 32)

debugInputImage = MPSImage(device: device,
imageDescriptor: imageDescriptor)

var arrayOfOnes = Array(repeating: Float(1.0),
count: imageDescriptor.width * imageDescriptor.height
* imageDescriptor.featureChannels)


let arrayOfOnes16 = toFloat16(&arrayOfOnes, size: arrayOfOnes.count)

debugInputImage.writeBytes(arrayOfOnes16,
dataLayout: MPSDataLayout.HeightxWidthxFeatureChannels, imageIndex: 0)


When I run all of this:



let commandBuffer = commandQueue.makeCommandBuffer()!
let outImage = convolution_depthwise_0.encode(commandBuffer: commandBuffer,
sourceImage: debugInputImage)


And get this error (at this line let outImage = convolution_depthwise_0.encode(...):



validateComputeFunctionArguments:860: failed assertion `Compute 
Function(depthwiseConvolution): missing threadgroupMemory binding
at index 0 for lM[0].'


For regular convolution everything is fine, only for Depthwise I get this problem.



What could be the reason for that error?



System: MacOS 10.14, XCode 10.1 beta 3



Only MPSCNNDepthWiseConvolutionDescriptor doesn't work. I have no problems with MPSCNNConvolutionDescriptor. I also have no problems on iOS, only Mac OS.










share|improve this question















I'm trying to execute a simple DepthwiseConvolution kernel with Metal Performance Shaders on MacOS and have problems with it. First I initialize an MPSImage (called debugInputImage) with proper size filled with some number, say 1.0. Then I create my convolutional kernel:



convolution_depthwise_0 = MPSCNNConvolution(device: device, 
weights: datasource_depthwise_0)


Where datasource_depthwise_0 is an instance of MPSCNNConvolutionDataSource with the following descriptor:



func descriptor() -> MPSCNNConvolutionDescriptor {
var desc = MPSCNNDepthWiseConvolutionDescriptor(kernelWidth: 3,
kernelHeight: 3,
inputFeatureChannels: 32,
outputFeatureChannels: 32)
return desc
}


This is how I initialise the input image:



let imageDescriptor = MPSImageDescriptor(channelFormat: .float16, 
width: 256, height: 256, featureChannels: 32)

debugInputImage = MPSImage(device: device,
imageDescriptor: imageDescriptor)

var arrayOfOnes = Array(repeating: Float(1.0),
count: imageDescriptor.width * imageDescriptor.height
* imageDescriptor.featureChannels)


let arrayOfOnes16 = toFloat16(&arrayOfOnes, size: arrayOfOnes.count)

debugInputImage.writeBytes(arrayOfOnes16,
dataLayout: MPSDataLayout.HeightxWidthxFeatureChannels, imageIndex: 0)


When I run all of this:



let commandBuffer = commandQueue.makeCommandBuffer()!
let outImage = convolution_depthwise_0.encode(commandBuffer: commandBuffer,
sourceImage: debugInputImage)


And get this error (at this line let outImage = convolution_depthwise_0.encode(...):



validateComputeFunctionArguments:860: failed assertion `Compute 
Function(depthwiseConvolution): missing threadgroupMemory binding
at index 0 for lM[0].'


For regular convolution everything is fine, only for Depthwise I get this problem.



What could be the reason for that error?



System: MacOS 10.14, XCode 10.1 beta 3



Only MPSCNNDepthWiseConvolutionDescriptor doesn't work. I have no problems with MPSCNNConvolutionDescriptor. I also have no problems on iOS, only Mac OS.







metal metal-performance-shaders






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 9 at 10:06

























asked Nov 7 at 16:55









Alexander Ponomarev

98211121




98211121








  • 1




    What OS are you running this on? I've been using depthwise convolutions a lot but haven't come across this error yet (on iOS anyway). It seems like an error in MPS. The only other thing I can think of is that perhaps your MPSImage is in a format not supported by the depthwise convolution.
    – Matthijs Hollemans
    Nov 8 at 10:02










  • @MatthijsHollemans I am running it on MacOS. I have added it to the question. I haven't tried it on IOS yet but probably it's something I have to do.
    – Alexander Ponomarev
    Nov 8 at 10:44






  • 1




    Are your inputFeatureChannels and outputFeatureChannels the same value?
    – Matthijs Hollemans
    Nov 8 at 10:58










  • @MatthijsHollemans yes, they are the same. Updated values in the question. Otherwise (just for example) I get two kind of errors: "multipler not 1 is not supported" or "output should be multiple of input". :) So those errors look easily understandable.
    – Alexander Ponomarev
    Nov 8 at 11:08






  • 1




    Is the validation layer enabled for a playground?
    – Ken Thomases
    Nov 8 at 16:39














  • 1




    What OS are you running this on? I've been using depthwise convolutions a lot but haven't come across this error yet (on iOS anyway). It seems like an error in MPS. The only other thing I can think of is that perhaps your MPSImage is in a format not supported by the depthwise convolution.
    – Matthijs Hollemans
    Nov 8 at 10:02










  • @MatthijsHollemans I am running it on MacOS. I have added it to the question. I haven't tried it on IOS yet but probably it's something I have to do.
    – Alexander Ponomarev
    Nov 8 at 10:44






  • 1




    Are your inputFeatureChannels and outputFeatureChannels the same value?
    – Matthijs Hollemans
    Nov 8 at 10:58










  • @MatthijsHollemans yes, they are the same. Updated values in the question. Otherwise (just for example) I get two kind of errors: "multipler not 1 is not supported" or "output should be multiple of input". :) So those errors look easily understandable.
    – Alexander Ponomarev
    Nov 8 at 11:08






  • 1




    Is the validation layer enabled for a playground?
    – Ken Thomases
    Nov 8 at 16:39








1




1




What OS are you running this on? I've been using depthwise convolutions a lot but haven't come across this error yet (on iOS anyway). It seems like an error in MPS. The only other thing I can think of is that perhaps your MPSImage is in a format not supported by the depthwise convolution.
– Matthijs Hollemans
Nov 8 at 10:02




What OS are you running this on? I've been using depthwise convolutions a lot but haven't come across this error yet (on iOS anyway). It seems like an error in MPS. The only other thing I can think of is that perhaps your MPSImage is in a format not supported by the depthwise convolution.
– Matthijs Hollemans
Nov 8 at 10:02












@MatthijsHollemans I am running it on MacOS. I have added it to the question. I haven't tried it on IOS yet but probably it's something I have to do.
– Alexander Ponomarev
Nov 8 at 10:44




@MatthijsHollemans I am running it on MacOS. I have added it to the question. I haven't tried it on IOS yet but probably it's something I have to do.
– Alexander Ponomarev
Nov 8 at 10:44




1




1




Are your inputFeatureChannels and outputFeatureChannels the same value?
– Matthijs Hollemans
Nov 8 at 10:58




Are your inputFeatureChannels and outputFeatureChannels the same value?
– Matthijs Hollemans
Nov 8 at 10:58












@MatthijsHollemans yes, they are the same. Updated values in the question. Otherwise (just for example) I get two kind of errors: "multipler not 1 is not supported" or "output should be multiple of input". :) So those errors look easily understandable.
– Alexander Ponomarev
Nov 8 at 11:08




@MatthijsHollemans yes, they are the same. Updated values in the question. Otherwise (just for example) I get two kind of errors: "multipler not 1 is not supported" or "output should be multiple of input". :) So those errors look easily understandable.
– Alexander Ponomarev
Nov 8 at 11:08




1




1




Is the validation layer enabled for a playground?
– Ken Thomases
Nov 8 at 16:39




Is the validation layer enabled for a playground?
– Ken Thomases
Nov 8 at 16:39

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53194202%2ffunctiondepthwiseconvolution-missing-threadgroupmemory-binding-at-index-0-for%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53194202%2ffunctiondepthwiseconvolution-missing-threadgroupmemory-binding-at-index-0-for%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Xamarin.form Move up view when keyboard appear

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Anylogic : not able to use stopDelay()