option.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #pragma once
  15. #include "ultra_infer/core/fd_type.h"
  16. #include <iostream>
  17. #include <memory>
  18. #include <string>
  19. #include <vector>
  20. namespace ultra_infer {
  21. /*! @brief Option object to configure Poros backend
  22. */
  23. struct PorosBackendOption {
  24. Device device = Device::CPU;
  25. int device_id = 0;
  26. bool long_to_int = true;
  27. // There is calculation precision in tf32 mode on A10, it can bring some
  28. // performance improvement, but there may be diff
  29. bool use_nvidia_tf32 = false;
  30. // Threshold for the number of non-const ops
  31. int32_t unconst_ops_thres = -1;
  32. std::string poros_file = "";
  33. std::vector<FDDataType> prewarm_datatypes = {FDDataType::FP32};
  34. // TRT options
  35. bool enable_fp16 = false;
  36. bool enable_int8 = false;
  37. bool is_dynamic = false;
  38. size_t max_batch_size = 32;
  39. size_t max_workspace_size = 1 << 30;
  40. };
  41. } // namespace ultra_infer