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
c3701240
Commit
c3701240
authored
Nov 28, 2023
by
Artur Wojcik
Browse files
fix function attributes
parent
caf6e335
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
9 deletions
+5
-9
test/jit.cpp
test/jit.cpp
+5
-9
No files found.
test/jit.cpp
View file @
c3701240
...
@@ -28,15 +28,15 @@
...
@@ -28,15 +28,15 @@
#include <migraphx/make_op.hpp>
#include <migraphx/make_op.hpp>
#include <test.hpp>
#include <test.hpp>
#if
n
def _WIN32
#ifdef _WIN32
#define EXPORT_SYMBOL R"migraphx(
extern "C"
)migraphx"
#define EXPORT_SYMBOL R"migraphx(
__declspec(dllexport)
)migraphx"
#else
#else
#define EXPORT_SYMBOL
R"migraphx(__declspec(dllexport))migraphx"
#define EXPORT_SYMBOL
#endif
#endif
// NOLINTNEXTLINE
// NOLINTNEXTLINE
const
std
::
string
add_42_src
=
EXPORT_SYMBOL
R"migraphx(
const
std
::
string
add_42_src
=
EXPORT_SYMBOL
R"migraphx(
int add(int x)
extern "C"
int add(int x)
{
{
return x+42;
return x+42;
}
}
...
@@ -69,18 +69,14 @@ std::function<F> compile_module(const migraphx::module& m, const std::string& fl
...
@@ -69,18 +69,14 @@ std::function<F> compile_module(const migraphx::module& m, const std::string& fl
{
{
migraphx
::
cpp_generator
g
;
migraphx
::
cpp_generator
g
;
g
.
fmap
([](
auto
&&
name
)
{
return
"std::"
+
name
;
});
g
.
fmap
([](
auto
&&
name
)
{
return
"std::"
+
name
;
});
g
.
create_function
(
g
.
generate_module
(
m
).
set_attributes
({
"extern
\"
C
\"
"
}));
g
.
create_function
(
g
.
generate_module
(
m
).
set_attributes
({
EXPORT_SYMBOL
"extern
\"
C
\"
"
}));
return
compile_function
<
F
>
(
preamble
+
g
.
str
(),
flags
,
m
.
name
());
return
compile_function
<
F
>
(
preamble
+
g
.
str
(),
flags
,
m
.
name
());
}
}
TEST_CASE
(
simple_run
)
TEST_CASE
(
simple_run
)
{
{
#ifdef _WIN32
auto
f
=
compile_function
<
int
(
int
)
>
(
add_42_src
,
""
,
"?add@@YAHH@Z"
);
#else
auto
f
=
compile_function
<
int
(
int
)
>
(
add_42_src
,
""
,
"add"
);
auto
f
=
compile_function
<
int
(
int
)
>
(
add_42_src
,
""
,
"add"
);
#endif
EXPECT
(
f
(
8
)
==
50
);
EXPECT
(
f
(
8
)
==
50
);
EXPECT
(
f
(
10
)
==
52
);
EXPECT
(
f
(
10
)
==
52
);
}
}
...
...
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