Skip to content

Commit

Permalink
try to fix glas
Browse files Browse the repository at this point in the history
  • Loading branch information
9il committed Jun 9, 2018
1 parent 57677ab commit fd9adb0
Show file tree
Hide file tree
Showing 16 changed files with 126 additions and 232 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ branches:
install:
- if [ $TRAVIS_OS_NAME = osx ]; then brew install gcc; fi
script:
- cd examples/ && dub --single --build=release gemm_example.d && cd ../
- cd examples/ && dub --single --build=release hemm_example.d && cd ../
- cd bench/ && dub --single --build=release gemm_report.d && cd ../
- bash -e test.sh
- dub --build=release --root examples/gemm
- dub --build=release --root examples/hemm
# - cd bench/ && dub --single --build=release gemm_report.d && cd ../
# - bash -e test.sh

notifications:
email:
Expand Down
138 changes: 0 additions & 138 deletions bench/gemm_report.d

This file was deleted.

5 changes: 4 additions & 1 deletion dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
"dflags-ldc": ["-betterC", "-linkonce-templates", "-enable-cross-module-inlining"]
},
},
"dependencies": {"mir-algorithm" : ">=0.6.9 <0.9.0"},
"dependencies": {
"mir-algorithm" : ">=0.9.0 <2.0.0",
"mir-cpuid": ">=0.5.3"
},
"configurations": [
{
"name": "auto-native",
Expand Down
14 changes: 14 additions & 0 deletions examples/gemm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.dub
docs.json
__dummy.html
docs/
gemm.so
gemm.dylib
gemm.dll
gemm.a
gemm.lib
gemm-test-*
*.exe
*.o
*.obj
*.lst
13 changes: 13 additions & 0 deletions examples/gemm/dub.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "gemm",
"targetType": "executable",
"lflags": [
"-L$MIR_GLAS_PACKAGE_DIR",
"-L$MIR_CPUID_PACKAGE_DIR"],
"dependencies": {
"mir-glas": {
"path": "../../"
},
"mir-algorithm": ">=1.0.1"
}
}
4 changes: 2 additions & 2 deletions examples/gemm_example.c → examples/gemm/gemm_example.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// gcc -std=c99 -I../include -c gemm_example.c -o gemm_example.o
// gcc gemm_example.o -L../ -lmir-glas -lmir-cpuid -o gemm_example
// gcc -std=c99 -I../../include -c gemm_example.c -o gemm_example.o
// gcc gemm_example.o -L../../ -lmir-glas -lmir-cpuid -o gemm_example
// ./gemm_example
#include <stdio.h>
#include <string.h>
Expand Down
13 changes: 0 additions & 13 deletions examples/gemm_example.d → examples/gemm/source/app.d
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
#!/usr/bin/env dub
/+ dub.json:
{
"name": "gemm_example",
"targetType":"executable",
"lflags": ["-L$MIR_GLAS_PACKAGE_DIR", "-L$MIR_CPUID_PACKAGE_DIR", "-L.."],
"dependencies": {
"mir-glas":{ "path": "../" },
"mir-cpuid": "~>0.5.2",
"mir-algorithm": "~>0.6.21"
}
}
+/
import glas.ndslice;
import mir.ndslice;

Expand Down
14 changes: 14 additions & 0 deletions examples/hemm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.dub
docs.json
__dummy.html
docs/
hemm.so
hemm.dylib
hemm.dll
hemm.a
hemm.lib
hemm-test-*
*.exe
*.o
*.obj
*.lst
13 changes: 13 additions & 0 deletions examples/hemm/dub.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "hemm",
"targetType": "executable",
"lflags": [
"-L$MIR_GLAS_PACKAGE_DIR",
"-L$MIR_CPUID_PACKAGE_DIR"],
"dependencies": {
"mir-glas": {
"path": "../../"
},
"mir-algorithm": ">=1.0.1"
}
}
4 changes: 2 additions & 2 deletions examples/hemm_example.c → examples/hemm/hemm_example.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// gcc -std=c99 -I../include -c hemm_example.c -o hemm_example.o
// gcc hemm_example.o -L../ -lmir-glas -lmir-cpuid -o hemm_example
// gcc -std=c99 -I../../include -c hemm_example.c -o hemm_example.o
// gcc hemm_example.o -L../../ -lmir-glas -lmir-cpuid -o hemm_example
// ./hemm_example
#include <complex.h>
#include <stdio.h>
Expand Down
15 changes: 1 addition & 14 deletions examples/hemm_example.d → examples/hemm/source/app.d
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
#!/usr/bin/env dub
/+ dub.json:
{
"name": "hemm_example",
"targetType":"executable",
"lflags": ["-L$MIR_GLAS_PACKAGE_DIR", "-L$MIR_CPUID_PACKAGE_DIR", "-L.."],
"dependencies": {
"mir-glas":{ "path": "../" },
"mir-cpuid": "~>0.5.2",
"mir-algorithm": "~>0.6.21"
}
}
+/
import mir.ndslice;
import glas.ndslice;
import mir.ndslice;

alias T = cdouble;

Expand Down
12 changes: 6 additions & 6 deletions source/glas/internal/config.d
Original file line number Diff line number Diff line change
Expand Up @@ -130,20 +130,20 @@ mixin template SSE2()

alias FPU = M8;

version(LDC_LLVM_400)
version(LDC_LLVM_300)
{
enum six = 6;
}
else
{
pragma(msg, "PERFORMANCE NOTE:
=======================================================================
LLVM 4.0 has a bug in register renaming.
LLVM >=4.0 has a bug in register renaming.
Computation kernels are not optimal!
For more details see issue https://github.com/libmir/mir-glas/issues/18
=======================================================================");
enum six = 5;
}
else
{
enum six = 6;
}

mixin template AVX512_S()
{
Expand Down
38 changes: 12 additions & 26 deletions source/glas/internal/l3_.d
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,9 @@ q{
int } ~ prefix!Type ~ q{gemm_(
ref const char transa,
ref const char transb,
ref const

FortranInt m,
ref const

FortranInt n,
ref const

FortranInt k,
ref const FortranInt m,
ref const FortranInt n,
ref const FortranInt k,
ref const T alpha,
const(T)* a,
ref const FortranInt lda,
Expand Down Expand Up @@ -130,20 +124,16 @@ q{
glas.ndslice.gemm(alpha, asl, bsl, beta, csl, settings);
return 0;
}
enum name = prefix!T.upper ~ "GEMM ";
enum name = prefix!T[0].toUpper ~ "GEMM ";
xerbla_(name.ptr, info);
return 0;
}

int } ~ prefix!Type ~ q{symm_(
ref const char side,
ref const char uplo,
ref const

FortranInt m,
ref const

FortranInt n,
ref const FortranInt m,
ref const FortranInt n,
ref const T alpha,
const(T)* a,
ref const FortranInt lda,
Expand All @@ -161,12 +151,8 @@ q{
int } ~ prefix!Type ~ q{hemm_(
ref const char side,
ref const char uplo,
ref const

FortranInt m,
ref const

FortranInt n,
ref const FortranInt m,
ref const FortranInt n,
ref const T alpha,
const(T)* a,
ref const FortranInt lda,
Expand All @@ -193,9 +179,9 @@ auto _matrix(T)(size_t[2] lengths, sizediff_t[2] strides, T* ptr)
}

pragma(inline, true)
package(glas) auto toUpper()(dchar c)
package(glas) auto toUpper()(char c)
{
return dchar(c & 0b1101_1111);
return char(c & 0b1101_1111);
}

pragma(inline, true)
Expand Down Expand Up @@ -271,8 +257,8 @@ package(glas) int symm_impl_(T)(
glas.ndslice.symm(alpha, asl, bsl, beta, csl, settings);
return 0;
}
enum nameSYMM = prefix!T.upper ~ "SYMM ";
enum nameHEMM = prefix!T.upper ~ "HEMM ";
enum nameSYMM = prefix!T[0].toUpper ~ "SYMM ";
enum nameHEMM = prefix!T[0].toUpper ~ "HEMM ";
xerbla_(conj ? nameHEMM.ptr : nameSYMM.ptr, info);
return 0;
}
Loading

0 comments on commit fd9adb0

Please sign in to comment.