首先單位是字節,比如 builder.max_workspace_size = 1<< 30 就是 2^30 bytes 即 1 GB。
它的作用是給出模型中任一層能使用的內存上限。運行時,每一層需要多少內存系統分配多少,並不是每次都分 1 GB,但不會超過 1 GB。
One particularly important property is the maximum workspace size.
Layer algorithms often require temporary workspace. This parameter limits the maximum size that any layer in the network can use. If an insufficient scratch is provided, it is possible that TensorRT may not be able to find an implementation for a given layer.
一個特別重要的特性是最大工作空間大小。
層算法通常需要臨時工作空間。 此參數限制網絡中任何層可以使用的最大大小。 如果提供的暫存不足,TensorRT 可能無法找到給定層的實現。
參考:
https://forums.developer.nvidia.com/t/the-significance-of-builder-max-workspace-size/72364/2
https://docs.nvidia.com/deeplearning/tensorrt/developer-guide/index.html#build_engine_c
