Open jiazhihao opened 10 months ago
More context:
producer_depth = 1
and consumer_depth = 0
get_depth()
returns 1 while IndexTask's get_context()->get_depth()
returns 0. The IndexTask was launched in a child task of top_level_task, so I would expect its depth to be 1.This is definitely an application bug (that deserves a better error message). Effectively this is saying that you're trying to use a Future that was produced in a child task in a parent task further up the task tree, which is illegal. You can't store Legion futures in the heap and then pass them out-of-band up the task tree. Future's lifetimes have to end at the task that produced them.
In frame 5 (on the consumer side), IndexTask's get_depth() returns 1 while IndexTask's get_context()->get_depth() returns 0. The IndexTask was launched in a child task of top_level_task, so I would expect its depth to be 1.
Right so this future was made in the "child task of top_level_task", but it is being used in the top_level_task, which is illegal. You need to pass things like this by-value back up the task tree.
@lightsighter In my use case, I created a background task T_B
that behaves like a worker, which iteratively pull requests from a work queue and launch Legion task. T_B
is a child task of the top_level_task
. T_B
launches two tasks T_1
and T_2
sequentially. T_1
is a normal task launch and T_2
is an indexed task launch. T_1
's result is used as the future by T_2
. Is this use case allow by legion?
BTW, is it expected that
IndexTask's get_depth() returns 1 while IndexTask's get_context()->get_depth() returns 0 ?
@lightsighter I was able to identify the issue. Am I correct that we can only call Runtime::get_context()
in the top_level task? It seems to give me incorrect Context
if I am calling it in a child task.
T_B launches two tasks T_1 and T_2 sequentially. T_1 is a normal task launch and T_2 is an indexed task launch. T_1's result is used as the future by T_2. Is this use case allow by legion?
That should be allowed, but I don't think that is where your error was coming from. The error reported above would have occurred if the top-level task tried to launch a sub-task using the future produced by T_1
from T_B
's context. The consumer_depth = 0
means that you were definitely using the future in the top-level task. The producer_depth = 1
means that the future was produced in a child task of the top-level task (e.g. like T_B
).
BTW, is it expected that: IndexTask's get_depth() returns 1 while IndexTask's get_context()->get_depth() returns 0
Yes, because you asked for the depth of the context of the task. By definition the depth of the context of a task is always one less than the depth of the task itself.
Am I correct that we can only call Runtime::get_context() in the top_level task? It seems to give me incorrect Context if I am calling it in a child task.
You can call Runtime::get_context
anywhere inside of a Legion task. I sincerely doubt it is giving you the wrong context. It will always return to you the same Context
argument that was passed as an argument to start the task. If you think you have a bug with Runtime::get_context
then make a small reproducer so we can look at it, but I would be very surprised fi that code is wrong as lots of people rely on it now.
I pushed a better error message for this failure mode if you want to try again and see what it says.
I ran into the following Legion assertion failure. I think this might be an application-side bug, but would be great if I can get some assistance to help me understand this assertion.
Backtrace: