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
gaoqiong
MIGraphX
Commits
d5bdfed0
"src/vscode:/vscode.git/clone" did not exist on "a55b079342cd28a67d0d2a7e192803cfeb170013"
Commit
d5bdfed0
authored
May 11, 2022
by
turneram
Browse files
Merge remote-tracking branch 'origin/develop' into transformer-opts
parents
5ded4ac1
4ec8209f
Changes
37
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
103 additions
and
32 deletions
+103
-32
.github/workflows/ci.yaml
.github/workflows/ci.yaml
+6
-5
CMakeLists.txt
CMakeLists.txt
+9
-2
Dockerfile
Dockerfile
+2
-6
cmake/Embed.cmake
cmake/Embed.cmake
+1
-0
cmake/EnableCompilerWarnings.cmake
cmake/EnableCompilerWarnings.cmake
+1
-0
doc/src/reference/py.rst
doc/src/reference/py.rst
+7
-0
examples/nlp/python_bert_squad/BERT-Squad.ipynb
examples/nlp/python_bert_squad/BERT-Squad.ipynb
+1
-1
examples/nlp/python_bert_squad/README.md
examples/nlp/python_bert_squad/README.md
+1
-1
hip-clang.docker
hip-clang.docker
+2
-5
src/api/api.cpp
src/api/api.cpp
+16
-0
src/api/include/migraphx/migraphx.h
src/api/include/migraphx/migraphx.h
+5
-0
src/api/include/migraphx/migraphx.hpp
src/api/include/migraphx/migraphx.hpp
+11
-0
src/api/migraphx.py
src/api/migraphx.py
+3
-0
src/driver/marker_roctx.cpp
src/driver/marker_roctx.cpp
+1
-1
src/include/migraphx/filesystem.hpp
src/include/migraphx/filesystem.hpp
+4
-1
src/include/migraphx/optional.hpp
src/include/migraphx/optional.hpp
+4
-1
src/onnx/parse_mean.cpp
src/onnx/parse_mean.cpp
+11
-8
src/py/migraphx_py.cpp
src/py/migraphx_py.cpp
+8
-0
src/simplify_algebra.cpp
src/simplify_algebra.cpp
+1
-1
src/targets/cpu/include/migraphx/cpu/parallel.hpp
src/targets/cpu/include/migraphx/cpu/parallel.hpp
+9
-0
No files found.
.github/workflows/ci.yaml
View file @
d5bdfed0
...
@@ -15,7 +15,8 @@ jobs:
...
@@ -15,7 +15,8 @@ jobs:
steps
:
steps
:
-
name
:
Free space
-
name
:
Free space
run
:
sudo rm -rf /usr/local/android /usr/share/dotnet /usr/local/share/boost /opt/ghc /usr/local/share/chrom* /usr/share/swift /usr/local/julia*
run
:
sudo rm -rf /usr/local/android /usr/share/dotnet /usr/local/share/boost /opt/ghc /usr/local/share/chrom* /usr/share/swift /usr/local/julia* /usr/local/lib/android
-
uses
:
actions/checkout@v2
-
uses
:
actions/checkout@v2
# In this step, this action saves a list of existing images,
# In this step, this action saves a list of existing images,
...
@@ -63,7 +64,7 @@ jobs:
...
@@ -63,7 +64,7 @@ jobs:
steps
:
steps
:
-
name
:
Free space
-
name
:
Free space
run
:
sudo rm -rf /usr/local/android /usr/share/dotnet /usr/local/share/boost /opt/ghc /usr/local/share/chrom* /usr/share/swift /usr/local/julia*
run
:
sudo rm -rf /usr/local/android /usr/share/dotnet /usr/local/share/boost /opt/ghc /usr/local/share/chrom* /usr/share/swift /usr/local/julia*
/usr/local/lib/android
-
uses
:
actions/checkout@v2
-
uses
:
actions/checkout@v2
# In this step, this action saves a list of existing images,
# In this step, this action saves a list of existing images,
...
@@ -108,7 +109,7 @@ jobs:
...
@@ -108,7 +109,7 @@ jobs:
steps
:
steps
:
-
name
:
Free space
-
name
:
Free space
run
:
sudo rm -rf /usr/local/android /usr/share/dotnet /usr/local/share/boost /opt/ghc /usr/local/share/chrom* /usr/share/swift /usr/local/julia*
run
:
sudo rm -rf /usr/local/android /usr/share/dotnet /usr/local/share/boost /opt/ghc /usr/local/share/chrom* /usr/share/swift /usr/local/julia*
/usr/local/lib/android
-
uses
:
actions/checkout@v2
-
uses
:
actions/checkout@v2
# In this step, this action saves a list of existing images,
# In this step, this action saves a list of existing images,
...
@@ -143,7 +144,7 @@ jobs:
...
@@ -143,7 +144,7 @@ jobs:
steps
:
steps
:
-
name
:
Free space
-
name
:
Free space
run
:
sudo rm -rf /usr/local/android /usr/share/dotnet /usr/local/share/boost /opt/ghc /usr/local/share/chrom* /usr/share/swift /usr/local/julia*
run
:
sudo rm -rf /usr/local/android /usr/share/dotnet /usr/local/share/boost /opt/ghc /usr/local/share/chrom* /usr/share/swift /usr/local/julia*
/usr/local/lib/android
-
uses
:
actions/checkout@v2
-
uses
:
actions/checkout@v2
-
name
:
Set up Python
-
name
:
Set up Python
uses
:
actions/setup-python@v2
uses
:
actions/setup-python@v2
...
@@ -182,7 +183,7 @@ jobs:
...
@@ -182,7 +183,7 @@ jobs:
steps
:
steps
:
-
name
:
Free space
-
name
:
Free space
run
:
sudo rm -rf /usr/local/android /usr/share/dotnet /usr/local/share/boost /opt/ghc /usr/local/share/chrom* /usr/share/swift /usr/local/julia*
run
:
sudo rm -rf /usr/local/android /usr/share/dotnet /usr/local/share/boost /opt/ghc /usr/local/share/chrom* /usr/share/swift /usr/local/julia*
/usr/local/lib/android
-
uses
:
actions/checkout@v2
-
uses
:
actions/checkout@v2
-
name
:
Set up Python
-
name
:
Set up Python
uses
:
actions/setup-python@v2
uses
:
actions/setup-python@v2
...
...
CMakeLists.txt
View file @
d5bdfed0
...
@@ -93,11 +93,14 @@ rocm_enable_clang_tidy(
...
@@ -93,11 +93,14 @@ rocm_enable_clang_tidy(
modernize-*
modernize-*
performance-*
performance-*
readability-*
readability-*
-bugprone-signed-char-misuse
-bugprone-easily-swappable-parameters
-bugprone-implicit-widening-of-multiplication-result
-bugprone-macro-parentheses
-bugprone-macro-parentheses
-bugprone-signed-char-misuse
# Disable the aliased reserved identifiers
# Disable the aliased reserved identifiers
-cert-dcl37-c
-cert-dcl37-c
-cert-dcl51-cpp
-cert-dcl51-cpp
-cert-err33-c
-cert-str34-c
-cert-str34-c
# Disable all alpha checks by default
# Disable all alpha checks by default
-clang-analyzer-alpha*
-clang-analyzer-alpha*
...
@@ -127,6 +130,7 @@ rocm_enable_clang_tidy(
...
@@ -127,6 +130,7 @@ rocm_enable_clang_tidy(
-cppcoreguidelines-pro-type-union-access
-cppcoreguidelines-pro-type-union-access
-cppcoreguidelines-pro-type-vararg
-cppcoreguidelines-pro-type-vararg
-cppcoreguidelines-special-member-functions
-cppcoreguidelines-special-member-functions
-cppcoreguidelines-virtual-class-destructor
-google-readability-*
-google-readability-*
-google-runtime-int
-google-runtime-int
-google-runtime-references
-google-runtime-references
...
@@ -144,8 +148,10 @@ rocm_enable_clang_tidy(
...
@@ -144,8 +148,10 @@ rocm_enable_clang_tidy(
-readability-convert-member-functions-to-static
-readability-convert-member-functions-to-static
-readability-else-after-return
-readability-else-after-return
-readability-function-cognitive-complexity
-readability-function-cognitive-complexity
-readability-identifier-length
-readability-named-parameter
-readability-named-parameter
-readability-redundant-string-init
-readability-redundant-string-init
-readability-suspicious-call-argument
-readability-uppercase-literal-suffix
-readability-uppercase-literal-suffix
-*-avoid-c-arrays
-*-avoid-c-arrays
-*-explicit-constructor
-*-explicit-constructor
...
@@ -216,6 +222,7 @@ rocm_enable_cppcheck(
...
@@ -216,6 +222,7 @@ rocm_enable_cppcheck(
CPPCHECK=1
CPPCHECK=1
__device__=
__device__=
__host__=
__host__=
__global__=
)
)
enable_testing
()
enable_testing
()
...
...
Dockerfile
View file @
d5bdfed0
FROM
ubuntu:
18
.04
FROM
ubuntu:
20
.04
ARG
PREFIX=/usr/local
ARG
PREFIX=/usr/local
...
@@ -6,7 +6,7 @@ ARG PREFIX=/usr/local
...
@@ -6,7 +6,7 @@ ARG PREFIX=/usr/local
RUN
dpkg
--add-architecture
i386
RUN
dpkg
--add-architecture
i386
# Add rocm repository
# Add rocm repository
RUN
sh
-c
'echo deb [arch=amd64 trusted=yes] http://repo.radeon.com/rocm/apt/
4.5
/ ubuntu main > /etc/apt/sources.list.d/rocm.list'
RUN
sh
-c
'echo deb [arch=amd64 trusted=yes] http://repo.radeon.com/rocm/apt/
5.0.2
/ ubuntu main > /etc/apt/sources.list.d/rocm.list'
# Install dependencies
# Install dependencies
RUN
apt-get update
&&
DEBIAN_FRONTEND
=
noninteractive apt-get
install
-y
--allow-unauthenticated
\
RUN
apt-get update
&&
DEBIAN_FRONTEND
=
noninteractive apt-get
install
-y
--allow-unauthenticated
\
...
@@ -16,16 +16,12 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-
...
@@ -16,16 +16,12 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-
cmake
\
cmake
\
curl
\
curl
\
doxygen
\
doxygen
\
g++-5
\
g++-7
\
g++-7
\
gdb
\
gdb
\
git
\
git
\
lcov
\
lcov
\
locales
\
locales
\
pkg-config
\
pkg-config
\
python
\
python-dev
\
python-pip
\
python3
\
python3
\
python3-dev
\
python3-dev
\
python3-pip
\
python3-pip
\
...
...
cmake/Embed.cmake
View file @
d5bdfed0
...
@@ -94,5 +94,6 @@ function(add_embed_library EMBED_NAME)
...
@@ -94,5 +94,6 @@ function(add_embed_library EMBED_NAME)
generate_embed_source
(
${
EMBED_NAME
}
SRC
${
SRC_FILE
}
HEADER
${
HEADER_FILE
}
OBJECTS
${
OUTPUT_FILES
}
SYMBOLS
${
SYMBOLS
}
)
generate_embed_source
(
${
EMBED_NAME
}
SRC
${
SRC_FILE
}
HEADER
${
HEADER_FILE
}
OBJECTS
${
OUTPUT_FILES
}
SYMBOLS
${
SYMBOLS
}
)
add_library
(
${
EMBED_NAME
}
STATIC
${
OUTPUT_FILES
}
"
${
SRC_FILE
}
"
)
add_library
(
${
EMBED_NAME
}
STATIC
${
OUTPUT_FILES
}
"
${
SRC_FILE
}
"
)
target_include_directories
(
${
EMBED_NAME
}
PUBLIC
"
${
EMBED_DIR
}
/include"
)
target_include_directories
(
${
EMBED_NAME
}
PUBLIC
"
${
EMBED_DIR
}
/include"
)
target_compile_options
(
${
EMBED_NAME
}
PRIVATE -Wno-reserved-identifier
)
set_target_properties
(
${
EMBED_NAME
}
PROPERTIES POSITION_INDEPENDENT_CODE On
)
set_target_properties
(
${
EMBED_NAME
}
PROPERTIES POSITION_INDEPENDENT_CODE On
)
endfunction
()
endfunction
()
cmake/EnableCompilerWarnings.cmake
View file @
d5bdfed0
...
@@ -96,6 +96,7 @@ else()
...
@@ -96,6 +96,7 @@ else()
-Wno-gnu-zero-variadic-macro-arguments
-Wno-gnu-zero-variadic-macro-arguments
-Wno-missing-prototypes
-Wno-missing-prototypes
-Wno-nested-anon-types
-Wno-nested-anon-types
-Wno-option-ignored
-Wno-padded
-Wno-padded
-Wno-shorten-64-to-32
-Wno-shorten-64-to-32
-Wno-sign-conversion
-Wno-sign-conversion
...
...
doc/src/reference/py.rst
View file @
d5bdfed0
...
@@ -146,6 +146,13 @@ module
...
@@ -146,6 +146,13 @@ module
:param list[module] mod_args: optional list of module arguments to the operator.
:param list[module] mod_args: optional list of module arguments to the operator.
:rtype instruction
:rtype instruction
.. py:method:: add_literal(data)
Adds constant or literal data of provided shape into the module from python buffer which includes numpy array.
:param py::buffer data: Python buffer or numpy array
:rtype instruction
.. py:method:: add_parameter(name, shape)
.. py:method:: add_parameter(name, shape)
Adds a parameter to the module with provided name and shape.
Adds a parameter to the module with provided name and shape.
...
...
examples/nlp/python_bert_squad/BERT-Squad.ipynb
View file @
d5bdfed0
...
@@ -62,7 +62,7 @@
...
@@ -62,7 +62,7 @@
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": [
"source": [
"!wget -nc https://github.com/onnx/models/
raw/master
/text/machine_comprehension/bert-squad/model/bertsquad-10.onnx"
"!wget -nc https://github.com/onnx/models/
blob/main
/text/machine_comprehension/bert-squad/model/bertsquad-10.onnx"
]
]
},
},
{
{
...
...
examples/nlp/python_bert_squad/README.md
View file @
d5bdfed0
...
@@ -23,7 +23,7 @@ unzip uncased_L-12_H-768_A-12.zip
...
@@ -23,7 +23,7 @@ unzip uncased_L-12_H-768_A-12.zip
```
```
5) Get BERT ONNX model (bertsquad-10.onnx):
5) Get BERT ONNX model (bertsquad-10.onnx):
```
```
wget https://github.com/onnx/models/
raw/master
/text/machine_comprehension/bert-squad/model/bertsquad-10.onnx
wget https://github.com/onnx/models/
blob/main
/text/machine_comprehension/bert-squad/model/bertsquad-10.onnx
```
```
6) Run the inference, it will compile and run the model on three questions and small data provided in
`inputs.json`
:
6) Run the inference, it will compile and run the model on three questions and small data provided in
`inputs.json`
:
```
```
...
...
hip-clang.docker
View file @
d5bdfed0
FROM
ubuntu:
18
.04
FROM
ubuntu:
20
.04
ARG
PREFIX=/usr/local
ARG
PREFIX=/usr/local
...
@@ -6,7 +6,7 @@ ARG PREFIX=/usr/local
...
@@ -6,7 +6,7 @@ ARG PREFIX=/usr/local
RUN
dpkg
--add-architecture
i386
RUN
dpkg
--add-architecture
i386
# Add rocm repository
# Add rocm repository
RUN
sh
-c
'echo deb [arch=amd64 trusted=yes] http://repo.radeon.com/rocm/apt/
4.5
/ ubuntu main > /etc/apt/sources.list.d/rocm.list'
RUN
sh
-c
'echo deb [arch=amd64 trusted=yes] http://repo.radeon.com/rocm/apt/
5.0.2
/ ubuntu main > /etc/apt/sources.list.d/rocm.list'
# Install dependencies
# Install dependencies
RUN
apt-get update
&&
DEBIAN_FRONTEND
=
noninteractive apt-get
install
-y
--allow-unauthenticated
\
RUN
apt-get update
&&
DEBIAN_FRONTEND
=
noninteractive apt-get
install
-y
--allow-unauthenticated
\
...
@@ -20,9 +20,6 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-
...
@@ -20,9 +20,6 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-
git
\
git
\
lcov
\
lcov
\
pkg-config
\
pkg-config
\
python
\
python-dev
\
python-pip
\
python3
\
python3
\
python3-dev
\
python3-dev
\
python3-pip
\
python3-pip
\
...
...
src/api/api.cpp
View file @
d5bdfed0
...
@@ -1072,6 +1072,22 @@ migraphx_module_add_instruction_with_mod_args(migraphx_instruction_t* out,
...
@@ -1072,6 +1072,22 @@ migraphx_module_add_instruction_with_mod_args(migraphx_instruction_t* out,
return
api_error_result
;
return
api_error_result
;
}
}
extern
"C"
migraphx_status
migraphx_module_add_literal
(
migraphx_instruction_t
*
out
,
migraphx_module_t
module
,
const_migraphx_shape_t
shape
,
const
char
*
buffer
)
{
auto
api_error_result
=
migraphx
::
try_
([
&
]
{
if
(
module
==
nullptr
)
MIGRAPHX_THROW
(
migraphx_status_bad_param
,
"Bad parameter module: Null pointer"
);
if
(
shape
==
nullptr
)
MIGRAPHX_THROW
(
migraphx_status_bad_param
,
"Bad parameter shape: Null pointer"
);
*
out
=
allocate
<
migraphx_instruction_t
>
(
(
module
->
object
).
add_literal
((
shape
->
object
),
(
buffer
)));
});
return
api_error_result
;
}
extern
"C"
migraphx_status
migraphx_module_add_parameter
(
migraphx_instruction_t
*
out
,
extern
"C"
migraphx_status
migraphx_module_add_parameter
(
migraphx_instruction_t
*
out
,
migraphx_module_t
module
,
migraphx_module_t
module
,
const
char
*
name
,
const
char
*
name
,
...
...
src/api/include/migraphx/migraphx.h
View file @
d5bdfed0
...
@@ -258,6 +258,11 @@ migraphx_status migraphx_module_add_instruction_with_mod_args(migraphx_instructi
...
@@ -258,6 +258,11 @@ migraphx_status migraphx_module_add_instruction_with_mod_args(migraphx_instructi
migraphx_instructions_t
args
,
migraphx_instructions_t
args
,
migraphx_modules_t
module_refs
);
migraphx_modules_t
module_refs
);
migraphx_status
migraphx_module_add_literal
(
migraphx_instruction_t
*
out
,
migraphx_module_t
module
,
const_migraphx_shape_t
shape
,
const
char
*
buffer
);
migraphx_status
migraphx_module_add_parameter
(
migraphx_instruction_t
*
out
,
migraphx_status
migraphx_module_add_parameter
(
migraphx_instruction_t
*
out
,
migraphx_module_t
module
,
migraphx_module_t
module
,
const
char
*
name
,
const
char
*
name
,
...
...
src/api/include/migraphx/migraphx.hpp
View file @
d5bdfed0
...
@@ -314,6 +314,7 @@ struct interface_base : Base
...
@@ -314,6 +314,7 @@ struct interface_base : Base
T
**
y
=
reinterpret_cast
<
T
**>
(
out
);
T
**
y
=
reinterpret_cast
<
T
**>
(
out
);
T
*
x
=
reinterpret_cast
<
T
*>
(
input
);
T
*
x
=
reinterpret_cast
<
T
*>
(
input
);
assert
(
x
!=
nullptr
and
y
!=
nullptr
and
*
y
==
nullptr
);
assert
(
x
!=
nullptr
and
y
!=
nullptr
and
*
y
==
nullptr
);
// cppcheck-suppress useSmartPointer
*
y
=
new
T
(
*
x
);
// NOLINT
*
y
=
new
T
(
*
x
);
// NOLINT
});
});
};
};
...
@@ -339,6 +340,7 @@ struct interface_base : Base
...
@@ -339,6 +340,7 @@ struct interface_base : Base
template
<
class
T
,
class
Setter
,
class
F
>
template
<
class
T
,
class
Setter
,
class
F
>
void
set_auto_fp
(
Setter
setter
,
F
f
)
void
set_auto_fp
(
Setter
setter
,
F
f
)
{
{
// cppcheck-suppress constParameter
return
set_fp
<
T
>
(
setter
,
[
=
](
T
&
obj
,
auto
out
,
auto
...
xs
)
{
return
set_fp
<
T
>
(
setter
,
[
=
](
T
&
obj
,
auto
out
,
auto
...
xs
)
{
auto_invoke
(
f
,
out
,
obj
,
auto_convert_param
(
rank
<
2
>
{},
xs
)...);
auto_invoke
(
f
,
out
,
obj
,
auto_convert_param
(
rank
<
2
>
{},
xs
)...);
});
});
...
@@ -760,6 +762,15 @@ struct module
...
@@ -760,6 +762,15 @@ struct module
return
instruction
(
op_ins
,
own
{});
return
instruction
(
op_ins
,
own
{});
}
}
template
<
typename
T
>
instruction
add_literal
(
const
migraphx
::
shape
&
s
,
T
*
buffer
)
{
migraphx_instruction_t
literal_ins
;
const
auto
*
buffer_ptr
=
reinterpret_cast
<
const
char
*>
(
buffer
);
call
(
&
migraphx_module_add_literal
,
&
literal_ins
,
mm
.
get
(),
s
.
get_handle_ptr
(),
buffer_ptr
);
return
instruction
(
literal_ins
,
own
{});
}
instruction
add_parameter
(
const
std
::
string
&
name
,
shape
s
)
instruction
add_parameter
(
const
std
::
string
&
name
,
shape
s
)
{
{
migraphx_instruction_t
param_ins
;
migraphx_instruction_t
param_ins
;
...
...
src/api/migraphx.py
View file @
d5bdfed0
...
@@ -212,6 +212,9 @@ def module(h):
...
@@ -212,6 +212,9 @@ def module(h):
module_refs
=
'std::vector<migraphx::module*>'
),
module_refs
=
'std::vector<migraphx::module*>'
),
fname
=
'add_instruction'
,
fname
=
'add_instruction'
,
returns
=
'migraphx::instruction_ref'
)
returns
=
'migraphx::instruction_ref'
)
h
.
method
(
'add_literal'
,
api
.
params
(
shape
=
'const migraphx::shape&'
,
buffer
=
'const char*'
),
returns
=
'migraphx::instruction_ref'
)
h
.
method
(
'add_parameter'
,
h
.
method
(
'add_parameter'
,
api
.
params
(
name
=
'const char*'
,
shape
=
'const migraphx::shape&'
),
api
.
params
(
name
=
'const char*'
,
shape
=
'const migraphx::shape&'
),
returns
=
'migraphx::instruction_ref'
)
returns
=
'migraphx::instruction_ref'
)
...
...
src/driver/marker_roctx.cpp
View file @
d5bdfed0
...
@@ -17,7 +17,7 @@ class marker_roctx
...
@@ -17,7 +17,7 @@ class marker_roctx
std
::
function
<
int
(
const
char
*
)
>
sym_roctx_range_push
;
std
::
function
<
int
(
const
char
*
)
>
sym_roctx_range_push
;
std
::
function
<
int
()
>
sym_roctx_range_pop
;
std
::
function
<
int
()
>
sym_roctx_range_pop
;
uint64_t
range_id
;
uint64_t
range_id
=
0
;
public:
public:
marker_roctx
()
marker_roctx
()
...
...
src/include/migraphx/filesystem.hpp
View file @
d5bdfed0
...
@@ -3,7 +3,10 @@
...
@@ -3,7 +3,10 @@
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
#if defined(__has_include) && !defined(CPPCHECK)
#if defined(CPPCHECK)
#define MIGRAPHX_HAS_FILESYSTEM 1
#define MIGRAPHX_HAS_FILESYSTEM_TS 1
#elif defined(__has_include)
#if __has_include(<filesystem>) && __cplusplus >= 201703L
#if __has_include(<filesystem>) && __cplusplus >= 201703L
#define MIGRAPHX_HAS_FILESYSTEM 1
#define MIGRAPHX_HAS_FILESYSTEM 1
#else
#else
...
...
src/include/migraphx/optional.hpp
View file @
d5bdfed0
...
@@ -3,7 +3,10 @@
...
@@ -3,7 +3,10 @@
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
#if defined(__has_include) && !defined(CPPCHECK)
#if defined(CPPCHECK)
#define MIGRAPHX_HAS_OPTIONAL 1
#define MIGRAPHX_HAS_OPTIONAL_TS 1
#elif defined(__has_include)
#if __has_include(<optional>) && __cplusplus >= 201703L
#if __has_include(<optional>) && __cplusplus >= 201703L
#define MIGRAPHX_HAS_OPTIONAL 1
#define MIGRAPHX_HAS_OPTIONAL 1
#else
#else
...
...
src/onnx/parse_mean.cpp
View file @
d5bdfed0
...
@@ -24,13 +24,16 @@ struct parse_mean : op_parser<parse_mean>
...
@@ -24,13 +24,16 @@ struct parse_mean : op_parser<parse_mean>
auto
divisor
=
info
.
add_literal
(
auto
divisor
=
info
.
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
args
[
0
]
->
get_shape
().
type
()},
{
num_data
}});
migraphx
::
literal
{
migraphx
::
shape
{
args
[
0
]
->
get_shape
().
type
()},
{
num_data
}});
return
std
::
accumulate
(
args
.
begin
(),
args
.
end
(),
args
[
0
],
[
&
](
auto
&
mean
,
auto
&
data_i
)
{
// TODO: Only divide when using floating-point
// Pre-divide each tensor element-wise by n to reduce risk of overflow during summation
return
std
::
accumulate
(
args
.
begin
()
+
1
,
data_i
=
info
.
add_broadcastable_binary_op
(
"div"
,
data_i
,
divisor
);
args
.
end
(),
info
.
add_broadcastable_binary_op
(
"div"
,
args
[
0
],
divisor
),
if
(
data_i
!=
args
[
0
])
[
&
](
auto
mean
,
auto
data_i
)
{
return
info
.
add_broadcastable_binary_op
(
"add"
,
mean
,
data_i
);
// Pre-divide each tensor element-wise by n to reduce risk of
return
data_i
;
// overflow during summation
auto
div
=
info
.
add_broadcastable_binary_op
(
"div"
,
data_i
,
divisor
);
return
info
.
add_broadcastable_binary_op
(
"add"
,
mean
,
div
);
});
});
}
}
};
};
...
...
src/py/migraphx_py.cpp
View file @
d5bdfed0
...
@@ -273,6 +273,14 @@ MIGRAPHX_PYBIND11_MODULE(migraphx, m)
...
@@ -273,6 +273,14 @@ MIGRAPHX_PYBIND11_MODULE(migraphx, m)
py
::
arg
(
"op"
),
py
::
arg
(
"op"
),
py
::
arg
(
"args"
),
py
::
arg
(
"args"
),
py
::
arg
(
"mod_args"
)
=
std
::
vector
<
migraphx
::
module
*>
{})
py
::
arg
(
"mod_args"
)
=
std
::
vector
<
migraphx
::
module
*>
{})
.
def
(
"add_literal"
,
[](
migraphx
::
module
&
mm
,
py
::
buffer
data
)
{
py
::
buffer_info
info
=
data
.
request
();
auto
literal_shape
=
to_shape
(
info
);
return
mm
.
add_literal
(
literal_shape
,
reinterpret_cast
<
char
*>
(
info
.
ptr
));
},
py
::
arg
(
"data"
))
.
def
(
.
def
(
"add_parameter"
,
"add_parameter"
,
[](
migraphx
::
module
&
mm
,
const
std
::
string
&
name
,
const
migraphx
::
shape
shape
)
{
[](
migraphx
::
module
&
mm
,
const
std
::
string
&
name
,
const
migraphx
::
shape
shape
)
{
...
...
src/simplify_algebra.cpp
View file @
d5bdfed0
...
@@ -995,7 +995,7 @@ struct find_split_transpose
...
@@ -995,7 +995,7 @@ struct find_split_transpose
auto
axis
=
any_cast
<
op
::
slice
>
(
slc
->
get_operator
()).
axes
.
front
();
auto
axis
=
any_cast
<
op
::
slice
>
(
slc
->
get_operator
()).
axes
.
front
();
auto
it
=
std
::
find
(
perm
.
begin
(),
perm
.
end
(),
axis
);
auto
it
=
std
::
find
(
perm
.
begin
(),
perm
.
end
(),
axis
);
assert
(
it
!=
perm
.
end
());
assert
(
it
!=
perm
.
end
());
auto
axis_new
=
static_cast
<
int64_t
>
(
std
::
distance
(
perm
.
begin
(),
it
)
)
;
int64_t
axis_new
=
std
::
distance
(
perm
.
begin
(),
it
);
for
(
auto
in
:
split_outputs
)
for
(
auto
in
:
split_outputs
)
{
{
...
...
src/targets/cpu/include/migraphx/cpu/parallel.hpp
View file @
d5bdfed0
...
@@ -7,7 +7,16 @@
...
@@ -7,7 +7,16 @@
#ifdef MIGRAPHX_DISABLE_OMP
#ifdef MIGRAPHX_DISABLE_OMP
#include <migraphx/par_for.hpp>
#include <migraphx/par_for.hpp>
#else
#else
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wreserved-identifier"
#endif
#include <omp.h>
#include <omp.h>
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif
#endif
namespace
migraphx
{
namespace
migraphx
{
...
...
Prev
1
2
Next
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