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
5d91adcf
Unverified
Commit
5d91adcf
authored
Jul 31, 2023
by
Artur Wojcik
Committed by
GitHub
Jul 30, 2023
Browse files
export API symbols from MIGraphX C dynamic library (#1990)
parent
c0c9001e
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
308 additions
and
270 deletions
+308
-270
src/api/CMakeLists.txt
src/api/CMakeLists.txt
+1
-0
src/api/api.cpp
src/api/api.cpp
+1
-1
src/api/include/migraphx/migraphx.h
src/api/include/migraphx/migraphx.h
+297
-265
test/api/test_custom_op.cpp
test/api/test_custom_op.cpp
+1
-1
tools/api.py
tools/api.py
+4
-2
tools/api/api.cpp
tools/api/api.cpp
+1
-1
tools/api/migraphx.h
tools/api/migraphx.h
+3
-0
No files found.
src/api/CMakeLists.txt
View file @
5d91adcf
...
@@ -26,6 +26,7 @@ add_library(migraphx_c
...
@@ -26,6 +26,7 @@ add_library(migraphx_c
api.cpp
api.cpp
)
)
set_target_properties
(
migraphx_c PROPERTIES EXPORT_NAME c
)
set_target_properties
(
migraphx_c PROPERTIES EXPORT_NAME c
)
migraphx_generate_export_header
(
migraphx_c DIRECTORY migraphx/api
)
# migraphx_c is stable API interface library. SO version of this should be
# migraphx_c is stable API interface library. SO version of this should be
# bumped when binary compatibility is broken.
# bumped when binary compatibility is broken.
...
...
src/api/api.cpp
View file @
5d91adcf
...
@@ -44,7 +44,7 @@ namespace migraphx {
...
@@ -44,7 +44,7 @@ namespace migraphx {
static
thread_local
bool
disable_exception_catch
=
false
;
// NOLINT
static
thread_local
bool
disable_exception_catch
=
false
;
// NOLINT
extern
"C"
void
migraphx_test_private_disable_exception_catch
(
bool
b
)
extern
"C"
MIGRAPHX_C_EXPORT
void
migraphx_test_private_disable_exception_catch
(
bool
b
)
{
{
disable_exception_catch
=
b
;
disable_exception_catch
=
b
;
}
}
...
...
src/api/include/migraphx/migraphx.h
View file @
5d91adcf
This diff is collapsed.
Click to expand it.
test/api/test_custom_op.cpp
View file @
5d91adcf
...
@@ -99,7 +99,7 @@ TEST_CASE(run_sigmoid_custom_op)
...
@@ -99,7 +99,7 @@ TEST_CASE(run_sigmoid_custom_op)
EXPECT
(
bool
{
result
==
migraphx
::
argument
(
s
,
expected_result
.
data
())});
EXPECT
(
bool
{
result
==
migraphx
::
argument
(
s
,
expected_result
.
data
())});
}
}
extern
"C"
void
migraphx_test_private_disable_exception_catch
(
bool
b
);
extern
"C"
MIGRAPHX_C_EXPORT
void
migraphx_test_private_disable_exception_catch
(
bool
);
TEST_CASE
(
run_sigmoid_with_incorrect_shape
)
TEST_CASE
(
run_sigmoid_with_incorrect_shape
)
{
{
...
...
tools/api.py
View file @
5d91adcf
...
@@ -36,6 +36,8 @@ error_type = ''
...
@@ -36,6 +36,8 @@ error_type = ''
success_type
=
''
success_type
=
''
try_wrap
=
''
try_wrap
=
''
export_c_macro
=
'MIGRAPHX_C_EXPORT'
c_header_preamble
:
List
[
str
]
=
[]
c_header_preamble
:
List
[
str
]
=
[]
c_api_body_preamble
:
List
[
str
]
=
[]
c_api_body_preamble
:
List
[
str
]
=
[]
cpp_header_preamble
:
List
[
str
]
=
[]
cpp_header_preamble
:
List
[
str
]
=
[]
...
@@ -125,7 +127,7 @@ class Type:
...
@@ -125,7 +127,7 @@ class Type:
header_function
=
Template
(
'''
header_function
=
Template
(
'''
${error_type} ${name}(${params});
${export_c_macro}
${error_type} ${name}(${params});
'''
)
'''
)
function_pointer_typedef
=
Template
(
'''
function_pointer_typedef
=
Template
(
'''
...
@@ -177,7 +179,7 @@ class CFunction:
...
@@ -177,7 +179,7 @@ class CFunction:
**
kwargs
)
**
kwargs
)
def
generate_header
(
self
)
->
str
:
def
generate_header
(
self
)
->
str
:
return
self
.
substitute
(
header_function
)
return
self
.
substitute
(
header_function
,
export_c_macro
=
export_c_macro
)
def
generate_function_pointer
(
self
,
name
:
Optional
[
str
]
=
None
)
->
str
:
def
generate_function_pointer
(
self
,
name
:
Optional
[
str
]
=
None
)
->
str
:
return
self
.
substitute
(
function_pointer_typedef
,
return
self
.
substitute
(
function_pointer_typedef
,
...
...
tools/api/api.cpp
View file @
5d91adcf
...
@@ -44,7 +44,7 @@ namespace migraphx {
...
@@ -44,7 +44,7 @@ namespace migraphx {
static
thread_local
bool
disable_exception_catch
=
false
;
// NOLINT
static
thread_local
bool
disable_exception_catch
=
false
;
// NOLINT
extern
"C"
void
migraphx_test_private_disable_exception_catch
(
bool
b
)
extern
"C"
MIGRAPHX_C_EXPORT
void
migraphx_test_private_disable_exception_catch
(
bool
b
)
{
{
disable_exception_catch
=
b
;
disable_exception_catch
=
b
;
}
}
...
...
tools/api/migraphx.h
View file @
5d91adcf
...
@@ -26,6 +26,9 @@
...
@@ -26,6 +26,9 @@
#include <stdlib.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdbool.h>
#include <migraphx/api/export.h>
// Add new types here
// Add new types here
// clang-format off
// clang-format off
#define MIGRAPHX_SHAPE_VISIT_TYPES(m) \
#define MIGRAPHX_SHAPE_VISIT_TYPES(m) \
...
...
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