mirror of
https://github.com/marian-nmt/marian.git
synced 2024-09-17 09:47:34 +03:00
* Change to __AVX__ macro defined by compiler * Source files should not be executable
This commit is contained in:
parent
6224cb16e2
commit
734a8791dd
@ -117,8 +117,6 @@ else(MSVC)
|
||||
message(STATUS "AVX support found")
|
||||
set(INTRINSICS "${INTRINSICS} -mavx")
|
||||
list(APPEND INTRINSICS_NVCC -Xcompiler\ -mavx)
|
||||
else()
|
||||
add_definitions(-DNO_AVX)
|
||||
endif(AVX_FOUND)
|
||||
if(AVX2_FOUND)
|
||||
message(STATUS "AVX2 support found")
|
||||
|
0
src/3rd_party/avx_mathfun.h
vendored
Executable file → Normal file
0
src/3rd_party/avx_mathfun.h
vendored
Executable file → Normal file
0
src/3rd_party/sse_mathfun.h
vendored
Executable file → Normal file
0
src/3rd_party/sse_mathfun.h
vendored
Executable file → Normal file
@ -174,7 +174,7 @@ public:
|
||||
};
|
||||
|
||||
// @TODO: consider how code can be shared via templating
|
||||
#ifndef NO_AVX
|
||||
#ifdef __AVX__
|
||||
struct float32x8 {
|
||||
private:
|
||||
__m256 f_;
|
||||
|
@ -319,7 +319,7 @@ struct Ops<float32x4> {
|
||||
|
||||
} // end namespace functional
|
||||
} // end namespace marian
|
||||
#ifndef NO_AVX
|
||||
#ifdef __AVX__
|
||||
#include "3rd_party/avx_mathfun.h"
|
||||
|
||||
namespace marian {
|
||||
|
@ -31,7 +31,7 @@ inline marian::Shape adapt<float32x4>(const marian::Shape& shape) {
|
||||
x4Shape.set(-1, shape[-1] / 4);
|
||||
return x4Shape;
|
||||
}
|
||||
#ifndef NO_AVX
|
||||
#ifdef __AVX__
|
||||
template <>
|
||||
inline marian::Shape adapt<float32x8>(const marian::Shape& shape) {
|
||||
ABORT_IF(shape[-1] % 8 != 0,
|
||||
|
@ -99,7 +99,7 @@ void elementFloat(const Functor& functor, marian::Tensor out, Tensors... tensors
|
||||
|
||||
if(div8) {
|
||||
// std::cerr << "8: " << functor.to_string() << std::endl;
|
||||
#ifndef NO_AVX
|
||||
#ifdef __AVX__
|
||||
element<float32x8>(functor, out, tensors...);
|
||||
return;
|
||||
#endif
|
||||
|
@ -425,7 +425,7 @@ void Softmax(Tensor out, Tensor in) {
|
||||
matchOrAbort<float>(out->type());
|
||||
matchOrAbort<float>(in->type());
|
||||
|
||||
#ifndef NO_AVX
|
||||
#ifdef __AVX__
|
||||
if(out->shape()[-1] % 8 == 0) {
|
||||
Softmax<float32x8>(out, in);
|
||||
return;
|
||||
@ -481,7 +481,7 @@ void LogSoftmax(Tensor out, Tensor in) {
|
||||
matchOrAbort<float>(out->type());
|
||||
matchOrAbort<float>(in->type());
|
||||
|
||||
#ifndef NO_AVX
|
||||
#ifdef __AVX__
|
||||
if(out->shape()[-1] % 8 == 0) {
|
||||
LogSoftmax<float32x8>(out, in);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user