| 591 | } |
| 592 | |
| 593 | inline void enableDLA( |
| 594 | nvinfer1::IBuilder* builder, nvinfer1::IBuilderConfig* config, int useDLACore, bool allowGPUFallback = true) |
| 595 | { |
| 596 | if (useDLACore >= 0) |
| 597 | { |
| 598 | if (builder->getNbDLACores() == 0) |
| 599 | { |
| 600 | std::cerr << "Trying to use DLA core " << useDLACore << " on a platform that doesn't have any DLA cores" |
| 601 | << std::endl; |
| 602 | assert("Error: use DLA core on a platfrom that doesn't have any DLA cores" && false); |
| 603 | } |
| 604 | if (allowGPUFallback) |
| 605 | { |
| 606 | config->setFlag(nvinfer1::BuilderFlag::kGPU_FALLBACK); |
| 607 | } |
| 608 | if (!config->getFlag(nvinfer1::BuilderFlag::kINT8)) |
| 609 | { |
| 610 | // User has not requested INT8 Mode. |
| 611 | // By default run in FP16 mode. FP32 mode is not permitted. |
| 612 | config->setFlag(nvinfer1::BuilderFlag::kFP16); |
| 613 | } |
| 614 | config->setDefaultDeviceType(nvinfer1::DeviceType::kDLA); |
| 615 | config->setDLACore(useDLACore); |
| 616 | } |
| 617 | } |
| 618 | |
| 619 | inline int32_t parseDLA(int32_t argc, char** argv) |
| 620 | { |
no test coverage detected