[clblas] 26/54: adding AutoGemm kernel selection logic for Fiji

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Thu Jan 14 20:07:35 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/sid
in repository clblas.

commit 99b3931e028fd4ad6e150cb67f4b1b7ae8cc3a76
Author: David Tanner <guacamoleo at gmail.com>
Date:   Mon Dec 7 10:26:32 2015 -0600

    adding AutoGemm kernel selection logic for Fiji
---
 src/library/CMakeLists.txt                      |  6 ++-
 src/library/blas/AutoGemm/AutoGemm.py           |  3 ++
 src/library/blas/AutoGemm/AutoGemmParameters.py | 62 ++++++++++++++++++++-----
 src/library/blas/AutoGemm/KernelSelection.py    |  7 +--
 4 files changed, 62 insertions(+), 16 deletions(-)

diff --git a/src/library/CMakeLists.txt b/src/library/CMakeLists.txt
index 0bc5089..5c51e0a 100644
--- a/src/library/CMakeLists.txt
+++ b/src/library/CMakeLists.txt
@@ -91,6 +91,10 @@ option( PRECOMPILE_GEMM_TRANS_CN "AutoGemm: pre-compile CN transpose cases" OFF)
 option( PRECOMPILE_GEMM_TRANS_CT "AutoGemm: pre-compile CT transpose cases" OFF)
 option( PRECOMPILE_GEMM_TRANS_CC "AutoGemm: pre-compile CC transpose cases" OFF)
 
+set( AUTOGEMM_ARCHITECTURE "Hawaii" CACHE STRING "AutoGemm: device for kernel selection logic" )
+set_property( CACHE AUTOGEMM_ARCHITECTURE PROPERTY STRINGS "Hawaii" "Fiji" )
+
+
 
 # opencl compiler version
 #set( PRECOMPILE_GEMM_OPENCL_VERSION "2.0" CACHE STRING "OpenCL compiler version supported by device driver." )
@@ -239,7 +243,7 @@ endif()#endif precompile active
 ################################################################################
 add_custom_command(
   OUTPUT ${AUTOGEMM_HEADERS} ${AUTOGEMM_SRC}
-  COMMAND python ${CMAKE_SOURCE_DIR}/library/blas/AutoGemm/AutoGemm.py --output-path ${CMAKE_BINARY_DIR}/include --opencl-compiler-version ${OPENCL_VERSION}
+  COMMAND python ${CMAKE_SOURCE_DIR}/library/blas/AutoGemm/AutoGemm.py --output-path ${CMAKE_BINARY_DIR}/include --opencl-compiler-version ${OPENCL_VERSION} --architecture ${AUTOGEMM_ARCHITECTURE}
   DEPENDS ${AUTOGEMM_SCRIPTS}
 )
 
diff --git a/src/library/blas/AutoGemm/AutoGemm.py b/src/library/blas/AutoGemm/AutoGemm.py
index 2bedeb4..936c001 100644
--- a/src/library/blas/AutoGemm/AutoGemm.py
+++ b/src/library/blas/AutoGemm/AutoGemm.py
@@ -21,6 +21,7 @@ import getopt
 import Common
 import Includes
 import KernelSelection
+import AutoGemmParameters
 import KernelOpenCL
 
 
@@ -32,6 +33,7 @@ if __name__ == "__main__":
   ap = argparse.ArgumentParser(description="AutoGemm")
   ap.add_argument("--output-path", dest="output" )
   ap.add_argument("--opencl-compiler-version", dest="clCompilerVersion", action="store", choices=["1.1", "1.2", "2.0" ])
+  ap.add_argument("--architecture", dest="architecture", action="store", choices=["Hawaii", "Fiji" ])
   args = ap.parse_args()
   if args.output:
     Common.setOutputPath(args.output)
@@ -40,6 +42,7 @@ if __name__ == "__main__":
 
   print "AutoGemm.py: using OpenCL " + args.clCompilerVersion + " compiler"
   Common.setClCompilerVersion(args.clCompilerVersion)
+  AutoGemmParameters.setArchitecture(args.architecture)
 
   KernelOpenCL.writeOpenCLKernels()
   KernelSelection.writeKernelSelection()
diff --git a/src/library/blas/AutoGemm/AutoGemmParameters.py b/src/library/blas/AutoGemm/AutoGemmParameters.py
index e5a5862..ee50211 100644
--- a/src/library/blas/AutoGemm/AutoGemmParameters.py
+++ b/src/library/blas/AutoGemm/AutoGemmParameters.py
@@ -5,7 +5,7 @@ import KernelParameters
 # Tile Parameters for Kernel Selection Data
 ################################################################################
 
-kernelSelectionData = {
+kernelSelectionDataHawaii = {
 # [ size, fallback tile, [ valid tiles ] ],
   "s":[
     [ 4000, [ 16, 16,  6,  6], [ [ 16, 16,  6,  6] ] ],
@@ -54,17 +54,55 @@ kernelSelectionData = {
     ],
   }
 
-"""
-for testing all micro-tile sizes
-    [  128, [ 16, 16,  8,  8], [ [ 16, 16,  8,  8] ] ],
-    [  112, [ 16, 16,  7,  7], [ [ 16, 16,  7,  7] ] ],
-    [   96, [ 16, 16,  6,  6], [ [ 16, 16,  6,  6] ] ],
-    [   80, [ 16, 16,  5,  5], [ [ 16, 16,  5,  5] ] ],
-    [   64, [ 16, 16,  4,  4], [ [ 16, 16,  4,  4] ] ],
-    [   48, [ 16, 16,  3,  3], [ [ 16, 16,  3,  3] ] ],
-    [   32, [ 16, 16,  2,  2], [ [ 16, 16,  2,  2] ] ],
-    [    0, [ 16, 16,  1,  1], [ [ 16, 16,  1,  1] ] ],
-"""
+kernelSelectionDataFiji = {
+  "s":[
+    [ 3072, [ 16, 16, 6, 6], [ [ 16, 16, 6, 6], [ 16, 16, 5, 5], [ 16, 16, 4, 4] ] ],
+    [ 2240, [ 16, 16, 6, 6], [ [ 16, 16, 6, 6], [ 16, 16, 4, 4], [ 16, 16, 5, 5], [ 16, 16, 3, 3] ] ],
+    [ 1760, [ 16, 16, 4, 4], [ [ 16, 16, 6, 6], [ 16, 16, 4, 4], [ 16, 16, 5, 5], [ 16, 16, 3, 3] ] ],
+    [ 1600, [ 16, 16, 4, 4], [ [ 16, 16, 4, 4], [ 16, 16, 6, 6], [ 16, 16, 5, 5], [ 16, 16, 3, 3] ] ],
+    [ 1056, [ 16, 16, 4, 4], [ [ 16, 16, 4, 4], [ 16, 16, 6, 6], [ 16, 16, 5, 5], [ 16, 16, 3, 3], [ 16, 16, 2, 2] ] ],
+    [  960, [ 16, 16, 4, 4], [ [ 16, 16, 4, 4], [ 16, 16, 5, 5], [ 16, 16, 3, 3], [ 16, 16, 2, 2] ] ],
+    [  736, [ 16, 16, 3, 3], [ [ 16, 16, 4, 4], [ 16, 16, 3, 3], [ 16, 16, 5, 5], [ 16, 16, 2, 2] ] ],
+    [  528, [ 16, 16, 3, 3], [ [ 16, 16, 4, 4], [ 16, 16, 3, 3], [ 16, 16, 2, 2], [ 16, 16, 1, 1] ] ],
+    [  432, [ 16, 16, 2, 2], [ [ 16, 16, 3, 3], [ 16, 16, 2, 2], [ 16, 16, 1, 1] ] ],
+    [  320, [ 16, 16, 2, 2], [ [ 16, 16, 2, 2], [ 16, 16, 1, 1] ] ],
+    [    0, [ 16, 16, 1, 1], [ [ 16, 16, 1, 1] ] ],
+  ],
+  "d":[
+    [ 3200, [ 16, 16, 4, 4], [ [ 16, 16, 4, 4], [ 16, 16, 5, 5], [ 16, 16, 2, 2], [  8,  8, 6, 6 ] ] ],
+    [ 1632, [ 16, 16, 2, 2], [ [ 16, 16, 4, 4], [ 16, 16, 2, 2], [ 16, 16, 5, 5], [  8,  8, 6, 6 ] ] ],
+    [ 1280, [ 16, 16, 2, 2], [ [ 16, 16, 4, 4], [ 16, 16, 2, 2], [ 16, 16, 5, 5], [  8,  8, 6, 6 ], [ 16, 16, 1, 1] ] ],
+    [ 1056, [ 16, 16, 2, 2], [ [ 16, 16, 2, 2], [ 16, 16, 1, 1] ] ],
+    [  672, [ 16, 16, 2, 2], [ [ 16, 16, 1, 1] ] ],
+    [    0, [ 16, 16, 1, 1], [ [ 16, 16, 1, 1] ] ],
+  ],
+  "c":[
+    [ 2240,  [ 16, 16, 4, 4], [ [ 16, 16, 4, 4], [ 16, 16, 6, 6], ] ],
+    [ 1440,  [ 16, 16, 4, 4], [ [ 16, 16, 4, 4], [ 16, 16, 6, 6], [ 16, 16, 5, 5], [ 16, 16, 2, 2] ] ],
+    [ 1088,  [ 16, 16, 2, 2], [ [ 16, 16, 4, 4], [ 16, 16, 3, 3], [ 16, 16, 2, 2], [ 16, 16, 5, 5] ] ],
+    [  704,  [ 16, 16, 2, 2], [ [ 16, 16, 2, 2], [ 16, 16, 3, 3], [ 16, 16, 5, 5] ] ],
+    [  528,  [ 16, 16, 2, 2], [ [ 16, 16, 2, 2], [ 16, 16, 3, 3], [ 16, 16, 1, 1] ] ],
+    [  336,  [ 16, 16, 2, 2], [ [ 16, 16, 2, 2], [ 16, 16, 1, 1] ] ],
+    [    0,  [ 16, 16, 1, 1], [ [ 16, 16, 1, 1] ] ],
+  ],
+  "z":[
+    [ 2528, [ 16, 16, 2, 2], [ [ 16, 16, 4, 4], [ 16, 16, 2, 2], [ 16, 16, 3, 3] ] ],
+    [ 1872, [ 16, 16, 2, 2], [ [ 16, 16, 2, 2], [ 16, 16, 3, 3], [ 16, 16, 1, 1] ] ],
+    [ 1040, [ 16, 16, 2, 2], [ [ 16, 16, 2, 2], [ 16, 16, 1, 1] ] ],
+    [  768, [ 16, 16, 1, 1], [ [ 16, 16, 2, 2], [ 16, 16, 1, 1] ] ],
+    [    0, [ 16, 16, 1, 1], [ [ 16, 16, 1, 1] ] ],
+  ]
+}
+
+kernelSelectionData = kernelSelectionDataHawaii
+def setArchitecture(architecture):
+  global kernelSelectionData, kernelSelectionDataHawaii, kernelSelectionDataFiji
+
+  if architecture == "Fiji":
+    kernelSelectionData = kernelSelectionDataFiji
+  else:
+    kernelSelectionData = kernelSelectionDataHawaii
+
 
 ################################################################################
 # Non-Tile Parameters
diff --git a/src/library/blas/AutoGemm/KernelSelection.py b/src/library/blas/AutoGemm/KernelSelection.py
index 2c05771..659ae67 100644
--- a/src/library/blas/AutoGemm/KernelSelection.py
+++ b/src/library/blas/AutoGemm/KernelSelection.py
@@ -675,9 +675,10 @@ def writeKernelSelection():
 # Main
 ################################################################################
 if __name__ == "__main__":
-  if len(sys.argv) == 2:
+  if len(sys.argv) == 3:
     Common.setOutputPath(sys.argv[1])
+    AutoGemmParameters.setArchitecture(sys.argv[2])
+    writeKernelSelection()
   else:
-    print "Warning: No output path specified; default is working directory."
-  writeKernelSelection()
+    print "USAGE: python KernelSelection.py output_path architecture"
 

-- 
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