Skip to content
Merged
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
16 changes: 8 additions & 8 deletions cpp/neuralnet/openclbackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ struct ConvLayer {
const int nnYLen;
const int paddedNNXYLen;

bool usingHGemmWmmaNHCW; // For 1x1 convs
bool usingHGemmWmmaNCHW; // For 1x1 convs

int numTilesX;
int numTilesY;
Expand Down Expand Up @@ -1125,7 +1125,7 @@ struct ConvLayer {
throw StringError("OpenCL backend: Encountered convolution dilation factors other than 1, not supported");

//Initial values unless overrided below
usingHGemmWmmaNHCW = false;
usingHGemmWmmaNCHW = false;
numTilesX = 0;
numTilesY = 0;
inTileXYSize = 0;
Expand All @@ -1142,7 +1142,7 @@ struct ConvLayer {
filter = createReadOnlyBuffer(handle,transWeights,useFP16);
if(handle->usingFP16TensorCoresFor1x1) {
if(inChannels % handle->getHGemmWmmaNCHWRequiredCDivisor() == 0 && outChannels % handle->getHGemmWmmaNCHWRequiredCDivisor() == 0) {
usingHGemmWmmaNHCW = true;
usingHGemmWmmaNCHW = true;
}
}
}
Expand Down Expand Up @@ -1276,7 +1276,7 @@ struct ConvLayer {

void apply(ComputeHandleInternal* handle, int batchSize, cl_mem input, cl_mem output, cl_mem convWorkspace, cl_mem convWorkspace2) const {
if(convXSize == 1 && convYSize == 1) {
if(!usingHGemmWmmaNHCW) {
if(!usingHGemmWmmaNCHW) {
int filterStride = 0; //Reuse same filter for all matrices in batch
int inputStride = paddedNNXYLen * inChannels;
int outputStride = paddedNNXYLen * outChannels;
Expand Down Expand Up @@ -2269,7 +2269,7 @@ struct TransformerMatMulLayer {
const int inChannels;
const int outChannels;
const int paddedNNXYLen;
bool usingHGemmWmmaNHCW;
bool usingHGemmWmmaNCHW;

cl_mem filter;

Expand All @@ -2281,7 +2281,7 @@ struct TransformerMatMulLayer {
inChannels(desc->inChannels),
outChannels(desc->outChannels),
paddedNNXYLen(handle->paddedNNXYLen),
usingHGemmWmmaNHCW(false)
usingHGemmWmmaNCHW(false)
{
testAssert(desc->weights.size() == (size_t)(inChannels * outChannels));
// MatMulLayerDesc weights are (inC, outC): weights[ic * outC + oc]
Expand All @@ -2292,7 +2292,7 @@ struct TransformerMatMulLayer {

if(handle->usingFP16TensorCoresFor1x1) {
if(inChannels % handle->getHGemmWmmaNCHWRequiredCDivisor() == 0 && outChannels % handle->getHGemmWmmaNCHWRequiredCDivisor() == 0) {
usingHGemmWmmaNHCW = true;
usingHGemmWmmaNCHW = true;
}
}
}
Expand All @@ -2305,7 +2305,7 @@ struct TransformerMatMulLayer {
// This is identical to a 1x1 convolution: output[n,oc,xy] = sum_ic input[n,ic,xy] * weight[ic,oc]
void apply(ComputeHandleInternal* handle, int batchSize, cl_mem input, cl_mem output, cl_mem mask, cl_mem convWorkspace) const {
(void)mask;
if(!usingHGemmWmmaNHCW) {
if(!usingHGemmWmmaNCHW) {
(void)convWorkspace;
int filterStride = 0; // Reuse same filter for all batch elements
int inputStride = paddedNNXYLen * inChannels;
Expand Down