MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / validate

Method validate

src/cpu/kernels/CpuDynamicGemmKernel.cpp:68–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68Status CpuDynamicGemmKernel::validate(const ITensorInfo *a,
69 const ITensorInfo *b,
70 const ITensorInfo *c,
71 const ITensorInfo *d,
72 float alpha,
73 float beta,
74 const GEMMInfo &gemm_info)
75{
76 ARM_COMPUTE_TRACE_EVENT(ARM_COMPUTE_PROF_CAT_CPU, ARM_COMPUTE_PROF_LVL_CPU, "CpuDynamicGemmKernel::validate");
77 ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(a, b, c, d);
78 ARM_COMPUTE_UNUSED(d);
79 ARM_COMPUTE_UNUSED(alpha);
80 ARM_COMPUTE_UNUSED(beta);
81 ARM_COMPUTE_UNUSED(gemm_info);
82
83 ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(a, 1, DataType::F32);
84 ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(a, b, c, d);
85
86 // If both a and b are static, so are c and d, rendering this kernel moot.
87 ARM_COMPUTE_RETURN_ERROR_ON(!a->is_dynamic() && !b->is_dynamic());
88 // ...conversely, when either a or b is dynamic, so is d.
89 ARM_COMPUTE_RETURN_ERROR_ON(!d->is_dynamic());
90 // What remains that could possibly be static is exactly one of a or b, and
91 // optionally c. Dimensions are checked in run_op.
92
93 // We expect to be able to pre-pack b and c if the values are constant, so
94 // they must be static.
95 if (b->are_values_constant())
96 {
97 ARM_COMPUTE_RETURN_ERROR_ON(b->is_dynamic());
98 }
99 if (c->are_values_constant())
100 {
101 ARM_COMPUTE_RETURN_ERROR_ON(c->is_dynamic());
102 }
103
104 ARM_COMPUTE_RETURN_ERROR_ON(alpha != 1.0f);
105 ARM_COMPUTE_RETURN_ERROR_ON(beta != 1.0f);
106
107 ARM_COMPUTE_RETURN_ERROR_ON(gemm_info.is_a_reshaped());
108 ARM_COMPUTE_RETURN_ERROR_ON(gemm_info.is_b_reshaped());
109 ARM_COMPUTE_RETURN_ERROR_ON(gemm_info.reshape_b_only_on_first_run() &&
110 (!b->are_values_constant() || !c->are_values_constant()));
111 ARM_COMPUTE_RETURN_ERROR_ON(gemm_info.depth_output_gemm3d() != 0);
112 ARM_COMPUTE_RETURN_ERROR_ON(gemm_info.reinterpret_input_as_3d());
113 ARM_COMPUTE_RETURN_ERROR_ON(gemm_info.retain_internal_weights());
114 ARM_COMPUTE_RETURN_ERROR_ON(gemm_info.gemmlowp_output_stage() != GEMMLowpOutputStageInfo{});
115 ARM_COMPUTE_RETURN_ERROR_ON(gemm_info.fast_math());
116 ARM_COMPUTE_RETURN_ERROR_ON(gemm_info.fp_mixed_precision());
117 ARM_COMPUTE_RETURN_ERROR_ON(gemm_info.broadcast_bias());
118 ARM_COMPUTE_RETURN_ERROR_ON(gemm_info.pretranspose_A());
119 ARM_COMPUTE_RETURN_ERROR_ON(gemm_info.pretranspose_B());
120 ARM_COMPUTE_RETURN_ERROR_ON(gemm_info.activation_info() != ActivationLayerInfo{});
121 ARM_COMPUTE_RETURN_ERROR_ON(gemm_info.fixed_format());
122 ARM_COMPUTE_RETURN_ERROR_ON(gemm_info.weight_format() != WeightFormat::UNSPECIFIED);
123 ARM_COMPUTE_RETURN_ERROR_ON(gemm_info.accumulate());
124
125 return Status{};

Callers

nothing calls this directly

Calls 15

is_a_reshapedMethod · 0.80
is_b_reshapedMethod · 0.80
gemmlowp_output_stageMethod · 0.80
fp_mixed_precisionMethod · 0.80
pretranspose_AMethod · 0.80
pretranspose_BMethod · 0.80
accumulateMethod · 0.80
is_dynamicMethod · 0.45
are_values_constantMethod · 0.45
depth_output_gemm3dMethod · 0.45

Tested by

no test coverage detected