Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
78ecd508
Unverified
Commit
78ecd508
authored
Apr 28, 2023
by
Ilia Taraban
Committed by
GitHub
Apr 28, 2023
Browse files
[Fix] fix libxsmm build issues on Mac OS (#5626)
parent
665c3798
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
16 deletions
+24
-16
CMakeLists.txt
CMakeLists.txt
+6
-2
src/array/cpu/spmm_blocking_libxsmm.h
src/array/cpu/spmm_blocking_libxsmm.h
+18
-14
No files found.
CMakeLists.txt
View file @
78ecd508
...
@@ -202,12 +202,16 @@ endif(NOT MSVC)
...
@@ -202,12 +202,16 @@ endif(NOT MSVC)
# Compile LIBXSMM
# Compile LIBXSMM
if
((
NOT MSVC
)
AND USE_LIBXSMM
)
if
((
NOT MSVC
)
AND USE_LIBXSMM
)
set
(
LIBXSMM_COMPILER
"
${
CMAKE_C_COMPILER
}
"
)
if
(
APPLE
)
set
(
LIBXSMM_COMPILER
"
${
CMAKE_C_COMPILER
}
-isysroot
${
CMAKE_OSX_SYSROOT
}
"
)
endif
()
if
(
REBUILD_LIBXSMM
)
if
(
REBUILD_LIBXSMM
)
add_custom_target
(
libxsmm COMMAND make realclean COMMAND make -j ECFLAGS=
"-Wno-error=deprecated-declarations"
BLAS=0 CC=
${
CMAKE_C
_COMPILER
}
add_custom_target
(
libxsmm COMMAND make realclean COMMAND make -j ECFLAGS=
"-Wno-error=deprecated-declarations"
BLAS=0 CC=
${
LIBXSMM
_COMPILER
}
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
/third_party/libxsmm
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
/third_party/libxsmm
)
)
else
(
REBUILD_LIBXSMM
)
else
(
REBUILD_LIBXSMM
)
add_custom_target
(
libxsmm COMMAND make -j ECFLAGS=
"-Wno-error=deprecated-declarations"
BLAS=0 CC=
${
CMAKE_C
_COMPILER
}
add_custom_target
(
libxsmm COMMAND make -j ECFLAGS=
"-Wno-error=deprecated-declarations"
BLAS=0 CC=
${
LIBXSMM
_COMPILER
}
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
/third_party/libxsmm
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
/third_party/libxsmm
)
)
endif
(
REBUILD_LIBXSMM
)
endif
(
REBUILD_LIBXSMM
)
...
...
src/array/cpu/spmm_blocking_libxsmm.h
View file @
78ecd508
...
@@ -42,8 +42,12 @@ struct CSRMatrixInternal {
...
@@ -42,8 +42,12 @@ struct CSRMatrixInternal {
};
};
int32_t
GetLLCSize
()
{
int32_t
GetLLCSize
()
{
#ifdef _SC_LEVEL3_CACHE_SIZE
int32_t
cache_size
=
sysconf
(
_SC_LEVEL3_CACHE_SIZE
);
int32_t
cache_size
=
sysconf
(
_SC_LEVEL3_CACHE_SIZE
);
if
(
cache_size
<
0
)
cache_size
=
DGL_CPU_LLC_SIZE
;
if
(
cache_size
<
0
)
cache_size
=
DGL_CPU_LLC_SIZE
;
#else
int32_t
cache_size
=
DGL_CPU_LLC_SIZE
;
#endif
return
cache_size
;
return
cache_size
;
}
}
...
@@ -292,9 +296,9 @@ inline void SpMMBlockwiseOpSum(
...
@@ -292,9 +296,9 @@ inline void SpMMBlockwiseOpSum(
const
DType
*
E
,
DType
*
C
,
bool
has_idx
,
IdType
N
,
IdType
num_M_blocks
,
const
DType
*
E
,
DType
*
C
,
bool
has_idx
,
IdType
N
,
IdType
num_M_blocks
,
IdType
num_K_blocks
,
IdType
M_block_size
,
IdType
num_K_blocks
,
IdType
M_block_size
,
libxsmm_meltwfunction_opreduce_vecs_idx
kernel
)
{
libxsmm_meltwfunction_opreduce_vecs_idx
kernel
)
{
DType
(
*
in_matrix1
)[
N
]
=
(
DType
(
*
)[
N
])
B
;
const
DType
*
in_matrix1
=
B
;
DType
(
*
in_matrix2
)[
N
]
=
(
DType
(
*
)[
N
])
E
;
const
DType
*
in_matrix2
=
E
;
DType
(
*
output
)[
N
]
=
(
DType
(
*
)[
N
])
C
;
DType
*
output
=
C
;
#pragma omp parallel
#pragma omp parallel
{
{
for
(
IdType
k
=
0
;
k
<
num_K_blocks
;
k
++
)
{
for
(
IdType
k
=
0
;
k
<
num_K_blocks
;
k
++
)
{
...
@@ -313,13 +317,13 @@ inline void SpMMBlockwiseOpSum(
...
@@ -313,13 +317,13 @@ inline void SpMMBlockwiseOpSum(
params
.
n
=
row_end
-
row_start
;
params
.
n
=
row_end
-
row_start
;
params
.
indices
=
&
cur_csr
.
indices
[
row_start
];
params
.
indices
=
&
cur_csr
.
indices
[
row_start
];
params
.
in_matrix
=
in_matrix1
;
params
.
in_matrix
=
in_matrix1
;
params
.
out_vec
=
&
output
[
dst
][
0
];
params
.
out_vec
=
&
output
[
dst
*
N
];
params
.
scale_vals
=
nullptr
;
params
.
scale_vals
=
nullptr
;
if
(
has_idx
)
{
if
(
has_idx
)
{
params
.
in_matrix2
=
in_matrix2
;
params
.
in_matrix2
=
in_matrix2
;
params
.
indices2
=
&
cur_csr
.
data
[
row_start
];
params
.
indices2
=
&
cur_csr
.
data
[
row_start
];
}
else
{
}
else
{
params
.
in_matrix2
=
&
in_matrix2
[
row_start
];
params
.
in_matrix2
=
&
in_matrix2
[
row_start
*
N
];
}
}
kernel
(
&
params
);
kernel
(
&
params
);
}
}
...
@@ -351,11 +355,11 @@ inline void SpMMBlockwiseOpCmp(
...
@@ -351,11 +355,11 @@ inline void SpMMBlockwiseOpCmp(
const
DType
*
E
,
DType
*
C
,
IdType
*
argB
,
IdType
*
argE
,
bool
has_idx
,
const
DType
*
E
,
DType
*
C
,
IdType
*
argB
,
IdType
*
argE
,
bool
has_idx
,
IdType
N
,
IdType
num_M_blocks
,
IdType
num_K_blocks
,
IdType
M_block_size
,
IdType
N
,
IdType
num_M_blocks
,
IdType
num_K_blocks
,
IdType
M_block_size
,
libxsmm_meltwfunction_opreduce_vecs_idx
kernel
)
{
libxsmm_meltwfunction_opreduce_vecs_idx
kernel
)
{
DType
(
*
in_matrix1
)[
N
]
=
(
DType
(
*
)[
N
])
B
;
const
DType
*
in_matrix1
=
B
;
DType
(
*
in_matrix2
)[
N
]
=
(
DType
(
*
)[
N
])
E
;
const
DType
*
in_matrix2
=
E
;
DType
(
*
output
)[
N
]
=
(
DType
(
*
)[
N
])
C
;
DType
*
output
=
C
;
IdType
(
*
out_matrix1
)[
N
]
=
(
IdType
(
*
)[
N
])
argB
;
IdType
*
out_matrix1
=
argB
;
IdType
(
*
out_matrix2
)[
N
]
=
(
IdType
(
*
)[
N
])
argE
;
IdType
*
out_matrix2
=
argE
;
#pragma omp parallel
#pragma omp parallel
{
{
...
@@ -375,15 +379,15 @@ inline void SpMMBlockwiseOpCmp(
...
@@ -375,15 +379,15 @@ inline void SpMMBlockwiseOpCmp(
params
.
n
=
row_end
-
row_start
;
params
.
n
=
row_end
-
row_start
;
params
.
indices
=
&
cur_csr
.
indices
[
row_start
];
params
.
indices
=
&
cur_csr
.
indices
[
row_start
];
params
.
in_matrix
=
in_matrix1
;
params
.
in_matrix
=
in_matrix1
;
params
.
out_vec
=
&
output
[
dst
][
0
];
params
.
out_vec
=
&
output
[
dst
*
N
];
params
.
argop_off_vec_0
=
&
out_matrix1
[
dst
][
0
];
params
.
argop_off_vec_0
=
&
out_matrix1
[
dst
*
N
];
params
.
argop_off_vec_1
=
&
out_matrix2
[
dst
][
0
];
params
.
argop_off_vec_1
=
&
out_matrix2
[
dst
*
N
];
params
.
scale_vals
=
nullptr
;
params
.
scale_vals
=
nullptr
;
if
(
has_idx
)
{
if
(
has_idx
)
{
params
.
in_matrix2
=
in_matrix2
;
params
.
in_matrix2
=
in_matrix2
;
params
.
indices2
=
&
cur_csr
.
data
[
row_start
];
params
.
indices2
=
&
cur_csr
.
data
[
row_start
];
}
else
{
}
else
{
params
.
in_matrix2
=
&
in_matrix2
[
row_start
];
params
.
in_matrix2
=
&
in_matrix2
[
row_start
*
N
];
}
}
kernel
(
&
params
);
kernel
(
&
params
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment