lift icon indicating copy to clipboard operation
lift copied to clipboard

Order of input combinations

Open ghost opened this issue 6 years ago • 3 comments

Dear Lift-developers, for benchmarking GEMM, I would like to use some self-defined input sizes. Is it sufficient to add these self-defined input sizes to the file https://github.com/lift-project/lift/blob/master/highLevel/mm.json before generating and running the OpenCL kernels? If so, can you please explain me the order of the matrix dimensions? Does each entry in the file (e.g., [512, 1024, 1024]) represent the parameters in the order 1) N (result matrix’s number of columns), 2) M (result matrix’s number of rows), and 3) K (first input matrix’s number of columns, and second input matrix’s number of rows), i.e., entries are of the form “[N,M,K]“? Thanks in advance!

ghost avatar Jul 08 '17 08:07 ghost

Yes, just add them to the json file. M is the number rows in A, K is the number of columns in A and the number of rows in B and N is the number of columns in B. The output matrix will be M by N. They appear in alphabetical order, so K,M,N.

tremmelg avatar Jul 13 '17 12:07 tremmelg

Thank you for answering. I have altered the json file to have the following content:

{
  "input_combinations" : [
    [64, 10, 500],
    [64, 2, 10],
    [50, 500, 64],
    [64, 500, 800],
    [1, 100, 10],
    [1, 100, 2],
    [1, 100, 500],
    [1, 20, 576],
    [25, 20, 576],
    [1, 50, 64],
    [500, 50, 64],
    [1, 64, 10],
    [2, 64, 10],
    [1, 64, 2],
    [1, 64, 500],
    [10, 64, 500],
    [500, 64, 800],
    [500, 100, 10],
    [10, 100, 2],
    [800, 100, 500],
    [576, 20, 25],
    [64, 50, 500],
    [500, 64, 10],
    [10, 64, 2],
    [800, 64, 500],
    [2048, 2048, 2048],
    [512, 512, 512],
    [1024, 1024, 1024],
    [512, 2048, 2048],
    [2048, 512, 512]
  ]
}

So the first line for example represents an input combination of a matrix a with 10 rows and 64 columns and a matrix b with 64 rows and 500 columns. This is the way you described it in your answer, right? However when I now run the Lift toolchain as described in http://lift-project.readthedocs.io/en/latest/exploration/index.html the output says

...
High-level expression : 52 / 57
Found 5 valid parameter sets
High-level expression : 53 / 57
Found 1 valid parameter sets
High-level expression : 54 / 57
Found 0 valid parameter sets
Found 61 low level expressions
Generated 0 kernels
High-level expression : 55 / 57
Found 0 valid parameter sets
Found 47 low level expressions
Generated 0 kernels
High-level expression : 56 / 57
Found 0 valid parameter sets
Found 614 low level expressions
Generated 0 kernels
High-level expression : 57 / 57
Found 0 valid parameter sets
Found 358 low level expressions
Generated 0 kernels

and the mmTransposedACl folder is empty. Could you please explain to me why that is and how it can be fixed?

ghost avatar Jul 14 '17 18:07 ghost

At the moment we use the first listed input size for filtering out some parameter combinations using heuristics. It could be that [64, 10, 500] causes all of them to fail, I'll check if that's the case later. You can look at the json configuration files in the highLevel folder to see some example on how to override the default values used by the heuristics. Also, bear in mind that we currently only pick parameters that are powers of 2, so for some of the input combinations you have listed there might only be very few that evenly divide them.

tremmelg avatar Jul 21 '17 08:07 tremmelg