"git@developer.sourcefind.cn:orangecat/ollama.git" did not exist on "9d91e5e5875e2b2f8605ef15a7da9a616cb05171"
Commit 60917cc7 authored by Paul's avatar Paul
Browse files

Sort based on weights

parent aea65ed4
...@@ -218,9 +218,13 @@ void schedule::apply(program& p) const ...@@ -218,9 +218,13 @@ void schedule::apply(program& p) const
// Topo sort // Topo sort
fix([&](auto self, auto ins) { fix([&](auto self, auto ins) {
for(auto i : ins->inputs()) auto args = ins->inputs();
std::sort(args.begin(), args.end(), [&](auto x, auto y) {
return si.weights[x] < si.weights[y];
});
for(auto i : args)
p.move_instruction(i, p.begin()); p.move_instruction(i, p.begin());
for(auto i : ins->inputs()) for(auto i : args)
self(i); self(i);
})(last); })(last);
......
...@@ -36,7 +36,7 @@ struct hip_device ...@@ -36,7 +36,7 @@ struct hip_device
static hip_stream_ptr create_stream() static hip_stream_ptr create_stream()
{ {
hipStream_t result = nullptr; hipStream_t result = nullptr;
auto status = hipStreamCreate(&result); auto status = hipStreamCreateWithFlags(&result, hipStreamNonBlocking);
if(status != hipSuccess) if(status != hipSuccess)
MIGRAPHX_THROW("Failed to allocate stream"); MIGRAPHX_THROW("Failed to allocate stream");
return hip_stream_ptr{result}; return hip_stream_ptr{result};
......
...@@ -13,7 +13,8 @@ using hip_event_ptr = MIGRAPHX_MANAGE_PTR(hipEvent_t, hipEventDestroy); ...@@ -13,7 +13,8 @@ using hip_event_ptr = MIGRAPHX_MANAGE_PTR(hipEvent_t, hipEventDestroy);
hip_event_ptr create_event() hip_event_ptr create_event()
{ {
hipEvent_t event; hipEvent_t event;
auto status = hipEventCreateWithFlags(&event, hipEventDisableTiming); // Default is hipEventReleaseToDevice
auto status = hipEventCreateWithFlags(&event, hipEventDisableTiming | hipEventReleaseToSystem | hipEventBlockingSync);
if(status != hipSuccess) if(status != hipSuccess)
MIGRAPHX_THROW("Failed to create event"); MIGRAPHX_THROW("Failed to create event");
return hip_event_ptr{event}; return hip_event_ptr{event};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment