MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / gemm_finalize_impl

Function gemm_finalize_impl

src/targets/gpu/gemm_impl.cpp:612–643  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

610 */
611template <class T>
612static int32_t gemm_finalize_impl(context& ctx,
613 const shape& output_shape,
614 const std::vector<shape>& input_shapes,
615 T alpha,
616 T beta,
617 bool compute_fp32,
618 int32_t solution_idx)
619{
620#ifdef MIGRAPHX_USE_ROCBLAS_TUNING_API
621
622 // This code should be called only if either the environment var.
623 // MIGRAPHX_ENABLE_GEMM_TUNING, or option --exhaustive-tune, is set
624
625 if(solution_idx == 0)
626 {
627 auto gemm_item = gemm_impl<T>(output_shape, input_shapes, alpha, beta, compute_fp32);
628 solution_idx = gemm_item.tune(ctx, input_shapes);
629 gemm_save_solution(ctx, output_shape, input_shapes, solution_idx);
630 }
631 else
632 {
633 // If a tuned solution index is already given, don't tune again but validate
634 // in case the data was tuned with a different rocBLAS version
635 auto gemm_item = gemm_impl<T>(output_shape, input_shapes, alpha, beta, compute_fp32);
636 solution_idx = gemm_item.validate(ctx, input_shapes, solution_idx);
637 }
638#else
639 (void)ctx, (void)output_shape, (void)input_shapes;
640 (void)alpha, (void)beta, (void)compute_fp32;
641#endif
642 return solution_idx;
643}
644
645int32_t gemm_finalize(context& ctx,
646 const shape& output_shape,

Callers 1

gemm_finalizeFunction · 0.85

Calls 3

gemm_save_solutionFunction · 0.85
tuneMethod · 0.45
validateMethod · 0.45

Tested by

no test coverage detected