From a7f5180857230a3bfd40ce6d46a3ba8e82eb7ff2 Mon Sep 17 00:00:00 2001 From: Torre Zuk Date: Mon, 22 Apr 2024 09:50:59 -0600 Subject: [PATCH] tolerance and doc comments --- Extensions/gemm_ex_bf16_r/gemm_ex_bf16_r.cpp | 8 ++++---- Extensions/gemm_ex_f16_r/Makefile | 4 ++-- Extensions/gemm_ex_f16_r/gemm_ex_f16_r.cpp | 3 +++ common/helpers.hpp | 7 ++++--- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Extensions/gemm_ex_bf16_r/gemm_ex_bf16_r.cpp b/Extensions/gemm_ex_bf16_r/gemm_ex_bf16_r.cpp index f278c13d..e70df3d3 100644 --- a/Extensions/gemm_ex_bf16_r/gemm_ex_bf16_r.cpp +++ b/Extensions/gemm_ex_bf16_r/gemm_ex_bf16_r.cpp @@ -1,5 +1,5 @@ /* ************************************************************************ - * Copyright (C) 2019-2023 Advanced Micro Devices, Inc. All rights reserved. + * Copyright (C) 2019-2024 Advanced Micro Devices, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -34,9 +34,9 @@ int main(int argc, char** argv) // set defaults options.M = 128; options.N = 128; - options.K = 128; - options.alpha = 2.0f; - options.beta = 3.0f; + options.K = 32; + options.alpha = 1.0f; + options.beta = 2.0f; if(!options.validArgs(argc, argv)) return EXIT_FAILURE; diff --git a/Extensions/gemm_ex_f16_r/Makefile b/Extensions/gemm_ex_f16_r/Makefile index f0e03d0a..e43d22a2 100644 --- a/Extensions/gemm_ex_f16_r/Makefile +++ b/Extensions/gemm_ex_f16_r/Makefile @@ -1,5 +1,5 @@ # ######################################################################## -# Copyright (C) 2019-2023 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (C) 2019-2024 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -48,7 +48,7 @@ OPT = -g -Wall # removing these temporarily as hipcc can not process # -Ofast -march=native INC = -I$(COMMON_PATH) -isystem$(ROCBLAS_PATH)/include -isystem$(ROCM_PATH)/include -CXXFLAGS = -std=c++14 $(INC) $(OPT) +CXXFLAGS = -std=c++14 $(INC) $(OPT) # -D__STDC_WANT_IEC_60559_TYPES_EXT__ ifneq ($(CXX),$(HIPCXX)) CXXFLAGS += -D__HIP_PLATFORM_AMD__ endif diff --git a/Extensions/gemm_ex_f16_r/gemm_ex_f16_r.cpp b/Extensions/gemm_ex_f16_r/gemm_ex_f16_r.cpp index f942e70e..abad3c88 100644 --- a/Extensions/gemm_ex_f16_r/gemm_ex_f16_r.cpp +++ b/Extensions/gemm_ex_f16_r/gemm_ex_f16_r.cpp @@ -200,6 +200,9 @@ int main(int argc, char** argv) 1, ldd); + // example printing gold results + // helpers::printMatrix("gold", hDGold.data(), M, N, ldd); + double maxRelativeError = helpers::maxRelativeError(hD, hDGold); double eps = std::numeric_limits::epsilon(); double tolerance = 10.0 * sqrt((double)K); diff --git a/common/helpers.hpp b/common/helpers.hpp index e3bdd068..ae616ebc 100644 --- a/common/helpers.hpp +++ b/common/helpers.hpp @@ -1,5 +1,5 @@ /* ************************************************************************ - * Copyright (C) 2019-2023 Advanced Micro Devices, Inc. All rights reserved. + * Copyright (C) 2019-2024 Advanced Micro Devices, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -21,6 +21,7 @@ * ************************************************************************ */ #pragma once + #include "ArgParser.hpp" #include "error_macros.h" #include "memoryHelpers.hpp" @@ -46,7 +47,7 @@ namespace helpers n = v.size(); for(size_t i = 0; i < n; i += inc) { - std::cout << v[i] << " "; + std::cout << (float)v[i] << " "; } std::cout << "\n"; } @@ -59,7 +60,7 @@ namespace helpers { for(int j = 0; j < n; j++) { - printf("%f ", A[i + j * lda]); + printf("%f ", (float)A[i + j * lda]); } printf("\n"); }