Skip to content

Commit

Permalink
Final cleanup for avx2 isolation and consistent file names (pytorch#40)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: pytorch#40

File name changes + removal of -mavx2 compiler flag non-avx files

This completes the separation of avx2 code to few files that make minimal use of c++ std lib.

Reviewed By: jianyuh

Differential Revision: D13330577

fbshipit-source-id: b469ebee484168800ce2d12fd2356edecbf0fa4d
  • Loading branch information
dskhudia authored and facebook-github-bot committed Dec 5, 2018
1 parent 7e1b543 commit 3af8fe5
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 17 deletions.
12 changes: 5 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ set(FBGEMM_GENERIC_SRCS src/ExecuteKernel.cc
src/ExecuteKernelU8S8.cc
src/Fbgemm.cc
src/FbgemmFP16.cc
src/FbgemmFP16UKernels.cc
src/FbgemmI8Spmdm.cc
src/GenerateKernelU8S8S32ACC16.cc
src/GenerateKernelU8S8S32ACC16_avx512.cc
src/GenerateKernelU8S8S32ACC16Avx512.cc
src/GenerateKernelU8S8S32ACC32.cc
src/GenerateKernelU8S8S32ACC32_avx512.cc
src/GenerateKernelU8S8S32ACC32Avx512.cc
src/PackAMatrix.cc
src/PackAWithIm2Col.cc
src/PackBMatrix.cc
Expand Down Expand Up @@ -64,13 +63,14 @@ endif()

#All the source files that either use avx2 instructions statically
set(FBGEMM_AVX2_SRCS
src/FbgemmFP16UKernelsAvx2.cc
src/FbgemmI8DepthwiseAvx2.cc
src/OptimizedKernelsAvx2.cc
src/QuantUtilsAvx2.cc
src/Utils_avx2.cc)
src/UtilsAvx2.cc)

#All the source files that use avx512 instructions statically
set(FBGEMM_AVX512_SRCS src/Utils_avx512.cc)
set(FBGEMM_AVX512_SRCS src/UtilsAvx512.cc)

set(FBGEMM_PUBLIC_HEADERS include/fbgemm/Fbgemm.h
include/fbgemm/OutputProcessing-inl.h
Expand All @@ -93,8 +93,6 @@ set_target_properties(fbgemm_generic fbgemm_avx2 fbgemm_avx512 PROPERTIES
CXX_EXTENSIONS NO
CXX_VISIBILITY_PRESET hidden)

target_compile_options(fbgemm_generic PRIVATE
"-m64" "-mavx2" "-mfma" "-masm=intel")
target_compile_options(fbgemm_avx2 PRIVATE
"-m64" "-mavx2" "-mfma" "-masm=intel")
target_compile_options(fbgemm_avx512 PRIVATE
Expand Down
1 change: 0 additions & 1 deletion include/fbgemm/Fbgemm.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
/**
* Top level include file for FBGEMM.
*/
#include <immintrin.h>
#include <cassert>
#include <cmath>
#include <limits>
Expand Down
2 changes: 1 addition & 1 deletion src/FbgemmFP16.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <array>
#include <utility>

#include "FbgemmFP16UKernels.h"
#include "FbgemmFP16UKernelsAvx2.h"

using namespace std;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "FbgemmFP16UKernels.h"
#include "FbgemmFP16UKernelsAvx2.h"

namespace fbgemm {

Expand Down
2 changes: 0 additions & 2 deletions src/FbgemmFP16UKernels.h → src/FbgemmFP16UKernelsAvx2.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
#ifndef FBGEMM_UKERNELS
#define FBGEMM_UKERNELS
#include <cstdint>
#include <tuple>
#include <vector>
#include "fbgemm/Types.h"

namespace fbgemm {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 3 additions & 5 deletions src/codegen_fp16fp32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,22 @@ int main() {

// open all files
ofstream srcfile;
srcfile.open("FbgemmFP16UKernels.cc");
srcfile.open("FbgemmFP16UKernelsAvx2.cc");
srcfile
<< "/*\n"
" * Copyright (c) Facebook, Inc. and its affiliates.\n"
" * All rights reserved.\n"
" * This source code is licensed under the BSD-style license found in the\n"
" * LICENSE file in the root directory of this source tree.\n"
" */\n";
srcfile << "#include \"FbgemmFP16UKernels.h\"\n\n";
srcfile << "#include \"FbgemmFP16UKernelsAvx2.h\"\n\n";
srcfile << "namespace fbgemm {\n\n";
if (iaca) {
srcfile << "#include \"iacaMarks.h\"\n";
}

ofstream hdrfile;
hdrfile.open("FbgemmFP16UKernels.h");
hdrfile.open("FbgemmFP16UKernelsAvx2.h");
hdrfile
<< "/*\n"
" * Copyright (c) Facebook, Inc. and its affiliates.\n"
Expand All @@ -92,8 +92,6 @@ int main() {
hdrfile << "#ifndef FBGEMM_UKERNELS\n";
hdrfile << "#define FBGEMM_UKERNELS\n";
hdrfile << "#include <cstdint>\n";
hdrfile << "#include <tuple>\n";
hdrfile << "#include <vector>\n";
hdrfile << "#include \"fbgemm/Types.h\"\n\n";
hdrfile << "namespace fbgemm {\n\n";
hdrfile << "using fp16 = float16;\n";
Expand Down

0 comments on commit 3af8fe5

Please sign in to comment.