MCPcopy Create free account
hub / github.com/alibaba/MNN / onEncode

Method onEncode

source/backend/vulkan/image/execution/VulkanMatMul.cpp:374–415  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

372}
373
374ErrorCode VulkanMatMul::onEncode(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs,
375 const VulkanCommandPool::Buffer *cmdBuffer) {
376 Tensor* C = outputs[0];
377 auto w0 = inputs[0]->length(1);
378 auto h0 = inputs[0]->length(0);
379 auto e = C->length(0);
380 auto h = C->length(1);
381 auto l = w0;
382 if (mTransposeA) {
383 l = h0;
384 }
385 MatMulInfo info;
386 info.e = e;
387 info.l = l;
388 info.h = h;
389 if (mTransposeA) {
390 info.aStride[0] = 1;
391 info.aStride[1] = e;
392 info.aStride[2] = 0;
393 } else {
394 info.aStride[0] = l;
395 info.aStride[1] = 1;
396 info.aStride[2] = 0;
397 }
398 if (mTransposeB) {
399 info.bStride[0] = 0;
400 info.bStride[1] = 1;
401 info.bStride[2] = l;
402 } else {
403 info.bStride[0] = 0;
404 info.bStride[1] = h;
405 info.bStride[2] = 1;
406 }
407 info.cStride[0] = h;
408 info.cStride[1] = 0;
409 info.cStride[2] = 1;
410 auto res = encode(inputs, outputs, cmdBuffer, info);
411 if (!res) {
412 return NOT_SUPPORT;
413 }
414 return NO_ERROR;
415}
416class VulkanMatMulCreator : public VulkanBackend::Creator {
417public:
418 virtual VulkanBasicExecution* onCreate(const std::vector<Tensor*>& inputs, const std::vector<Tensor*>& outputs, const MNN::Op* op, Backend* bn) const override {

Callers

nothing calls this directly

Calls 2

encodeFunction · 0.85
lengthMethod · 0.45

Tested by

no test coverage detected