[clblas] 56/125: A fix for an uninitialized variable in the tune tool. The problem would manifest itself when the --store-kernels flag was used on the command line. Comments were added to clarify a few sections of code.
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Fri May 29 06:57:22 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch master
in repository clblas.
commit fae4a1b508c5f9ce664d67c5b7640aa773f272f4
Author: Kent Knox <kent.knox at amd>
Date: Tue Mar 11 12:11:32 2014 -0500
A fix for an uninitialized variable in the tune tool. The problem
would manifest itself when the --store-kernels flag was used on the
command line.
Comments were added to clarify a few sections of code.
---
src/include/trace_malloc.h | 2 +-
src/library/tools/tune/tune.c | 53 +++++++++++++++++++++++++++++++++++--------
2 files changed, 44 insertions(+), 11 deletions(-)
diff --git a/src/include/trace_malloc.h b/src/include/trace_malloc.h
index 3dfa315..acc9753 100644
--- a/src/include/trace_malloc.h
+++ b/src/include/trace_malloc.h
@@ -48,7 +48,7 @@ void releaseMallocTrace(void);
static __inline void initMallocTrace(void)
{
- /* do noting */
+ /* do nothing */
}
static __inline void printMallocStatistics(void)
diff --git a/src/library/tools/tune/tune.c b/src/library/tools/tune/tune.c
index 8050cb5..b6174c4 100644
--- a/src/library/tools/tune/tune.c
+++ b/src/library/tools/tune/tune.c
@@ -309,12 +309,12 @@ struct GeneratorInfoRec {
DeviceInfo deviceInfos; // Todo delete this member. Use TargetDevice.
char *deviceName; //
- bool aFunc[BLAS_FUNCTIONS_NUMBER];
+ bool aFunc[BLAS_FUNCTIONS_NUMBER]; // True/false value if the corresponding function should be tuned
int aPattern;
- bool aDType[TYPE_NUMBER];
+ bool aDType[TYPE_NUMBER]; // True false value if the precision should be tuned; s/d/c/z
int aFlag;
int aCommand;
- bool aIsKernel;
+ bool aIsKernel; // True/false value to store binary kernels into the kernel database
int aMaxparam;
bool aExtendedOutput;
bool aAll;
@@ -2247,14 +2247,29 @@ generateKernelForOthersFlag( BlasExtraInfo* bExtra,
bestParamOther[nDim]->count++;
}
}
+
+ // If the user selected that they want to store the kernel binaries to disk,
+ // and we do not have those binaries, generate them again
if (genInfo.aIsKernel && bestParamOther[nDim]->kernel == NULL) {
+ MatrixInfo mi [DIMARRAYCOUNT];
unsigned int func = bFunc->funcNo;
unsigned int patt = bPatt->pattNo;
+
+ // Initialize resources to generate kernels in genAllKernel
initCLBLASExtra(&extra, bExtra);
- genAllKernel(&args, extra, bestParamOther[nDim],
- pattern, func, patt);
- logKernalGen();
+ initMatrixInfo( mi, extra.dtype, &genInfo.deviceInfos, bExtra );
+ initCLBlasKArgDim( &args, mi, extra.flags );
+
+ genAllKernel(&args, extra, bestParamOther[nDim], pattern, func, patt);
+
+ // Free those resources when finished
+ releaseMemObjAll( mi, bExtra );
+ destroyMatrixInfo( mi, bExtra );
+
+ logKernalGen( );
}
+
+ // This stores the kernel binaries to disk
saveBestParams(bExtraOther, bestParamOther);
}
deleteGParams(bExtraOther, bestParamOther);
@@ -2304,13 +2319,22 @@ createFile(void)
bool isEnvPattSelected = false;
unsigned int dev;
- initOpenCl();
+ // This intializes global genInfo with either the last detected platform, or the
+ // first AMD platform it finds. It records the number of devices in that platform.
+ initOpenCl( );
+
// For each devices
for (dev = 0; dev < genInfo.numDevices; dev++) {
initDevice(dev);
+
+ // The following creates the .kdb file on disk according to the set environment variable
writeStorageCache(&genInfo.targetDevice);
- getContext();
- configurePattern();
+
+ // The following creates the OpenCL context and commanqueue for the first device in global genInfo struct
+ getContext( );
+
+ // Does nothing; nop
+ configurePattern( );
// for each function
for (funcId = 0; funcId < BLAS_FUNCTIONS_NUMBER; funcId++) {
@@ -2378,6 +2402,9 @@ createFile(void)
bExtra = &(bPatt->extra[nExtra]);
genInfo.last = 0;
+ // This evaluates whether the current combination of parameters from the given function should be tuned or not
+ // If skipFlags returns 1, then the this combination is skipped
+ // This checks for hardcoded combinations which are skipped because of known runtime bugs.
if ( skipFlags(bExtra,
pattId,
funcId,
@@ -2386,6 +2413,7 @@ createFile(void)
continue;
}
+ // Similar logic to skipFlags, but this mostly filters out cases that were specified on the command line
if (isFilter(bExtra, pattId, funcId)) {
continue;
}
@@ -2636,8 +2664,13 @@ main(int argc, char* argv[])
{
FILE_PATH = getenv(ENV_FILE_PATH);
- initGeneratorInfoRec();
+ // This clears and initializes the global GeneratorInfoRec genInfo struct
+ initGeneratorInfoRec( );
parseArg(argc, argv);
+
+ // This will
+ // Set up the global clblasSolvers for all function families supported within blas, including initializing memory patterns
+ // Identify all recognized devices in the system
clblasSetup();
if (!FILE_PATH){
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/clblas.git
More information about the debian-science-commits
mailing list