-
Notifications
You must be signed in to change notification settings - Fork 621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add C API call to check backend of an operator #3031
Conversation
d134464
to
dd10c97
Compare
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
dd10c97
to
e8a729f
Compare
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
dali/c_api/c_api.cc
Outdated
@@ -543,6 +543,21 @@ void daliGetReaderMetadata(daliPipelineHandle* pipe_handle, const char *reader_n | |||
meta->stick_to_shard = returned_meta.stick_to_shard; | |||
} | |||
|
|||
dali_backend_t daliGetOperatorBackend(daliPipelineHandle* pipe_handle, const char *name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about operator_name
? Or op_name
? Won't hurt us ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
include/dali/c_api.h
Outdated
DLL_PUBLIC dali_backend_t daliGetOperatorBackend(daliPipelineHandle* pipe_handle, | ||
const char *name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about operator_name
? Or op_name
? Won't hurt us ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
include/dali/c_api.h
Outdated
typedef enum { | ||
DALI_BACKEND_GPU = 0, | ||
DALI_BACKEND_CPU = 1, | ||
DALI_BACKEND_MIXED = 2 | ||
} dali_backend_t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple things here.
In device_type_t
we assign CPU=0
and GPU=1
and here it's reversed. How about making this consistent?
CPU=0, GPU=1, MIXED=2
Secondly, in device_type_t
we don't use DALI
prefix for the enum name. Maybe we should keep this consistent also? After all, there's dali
already in type name, so it's still readable:
typedef enum {
CPU = 0,
GPU = 1,
MIXED = 2
} dali_backend_t;
dali_backend_t::CPU;
dali_backend_t::GPU;
dali_backend_t::MIXED;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's device type that is inconsistent with the rest of the enums. Also, C enums without a prefix are a bad idea, because you can reference them without device_type_t::*, so our namespace is polluted with CPU
and GPU
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't even name those CPU
and GPU
. The names are already taken by the device_type_t
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's device type that is inconsistent with the rest of the enums
I'm wondering, that in C API I see only device_type_t
enum so far, so maybe it's good idea to keep them consistent within single API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About the reverse order - it's taken from OpType
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering, that in C API I see only
device_type_t
enum so far, so maybe it's good idea to keep them consistent within single API?
typedef enum {
DALI_NO_TYPE = -1,
DALI_UINT8 = 0,
DALI_UINT16 = 1,
DALI_UINT32 = 2,
DALI_UINT64 = 3,
DALI_INT8 = 4,
DALI_INT16 = 5,
DALI_INT32 = 6,
DALI_INT64 = 7,
DALI_FLOAT16 = 8,
DALI_FLOAT = 9,
DALI_FLOAT64 = 10,
DALI_BOOL = 11,
} dali_data_type_t;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the order of the GPU and CPU
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
!build |
CI MESSAGE: [2460513]: BUILD STARTED |
CI MESSAGE: [2460513]: BUILD FAILED |
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
!build |
CI MESSAGE: [2460868]: BUILD STARTED |
CI MESSAGE: [2460868]: BUILD PASSED |
Why we need this PR?
We need to check the backend of an ExternalSource in DALI Triton backend.
What happened in this PR?
Added an C API call to check backend of an operator.
c_api.h/cc
api design
added case to C API tests
API call documentation
JIRA TASK: DALI-2000