GNU/Linux - Linux Kernel Device model

Linux 设备模型是 Linux 内核中的一个框架,它提供了一种统一、一致的方式来管理和表示硬件设备。设备模型抽象了硬件的细节,使得开发和维护驱动程序和子系统变得更加容易。以下是 Linux 设备模型的关键组成部分和概念:

关键组成部分

  1. 设备 (Devices)

    • 表示系统中的硬件组件。

    • 每个设备在内核中由 struct device 表示。

    • 设备按照层次结构组织,反映它们的物理或逻辑关系(例如,USB 设备是 USB 主机控制器的子设备)。

  2. 驱动程序 (Drivers)

    • 管理和控制设备的软件组件。

    • 每个驱动程序在内核中由 struct device_driver 表示。

    • 驱动程序提供初始化、配置和管理设备的方法。

  3. 总线 (Buses)

    • 表示设备之间的通信通道。

    • 例如 PCI、USB 和 I2C。

    • 每种总线类型在内核中由 struct bus_type 表示。

    • 总线负责设备的枚举和设备与驱动程序的绑定。

  4. 类 (Classes)

    • 表示具有共同功能的设备类别。

    • 例如块设备、网络设备和输入设备。

    • 每个类在内核中由 struct class 表示。

    • 类提供了一种将具有相似功能的设备分组并以一致的方式向用户空间公开的方法。

  5. 子系统 (Subsystems)

    • 分组相关设备和驱动程序的更高级抽象。

    • 子系统通常对应于特定类型的硬件或功能(例如 USB 子系统、SCSI 子系统)。

核心概念

  1. 设备树 (Device Tree)

    • 系统中设备的层次表示。

    • 设备树反映设备的物理或逻辑排列。

    • 用于表示内置硬件和可热插拔设备。

  2. Sysfs

    • 一个虚拟文件系统,将设备、驱动程序和总线的信息暴露给用户空间。

    • 位于文件系统层次结构中的 /sys。

    • 允许用户空间应用程序与设备进行交互和配置。

  3. 设备注册和注销 (Device Registration and Deregistration)

    • 设备和驱动程序注册到内核,内核管理它们的生命周期。

    • 注册涉及将设备或驱动程序添加到内核中的适当数据结构。

    • 注销涉及从这些数据结构中删除设备或驱动程序。

blackyin@yin:~/Desktop/tensorRT_Pro-YOLOv8/workspace$ bash build.sh &&&& RUNNING TensorRT.trtexec [TensorRT v8601] # /opt/TensorRT-8.6.1.6/bin/trtexec --onnx=rtdetr-l.onnx --minShapes=images:1x3x640x640 --optShapes=images:1x3x640x640 --maxShapes=images:16x3x640x640 --saveEngine=rtdetr-l.FP32.trtmodel [07/24/2025-01:09:02] [I] === Model Options === [07/24/2025-01:09:02] [I] Format: ONNX [07/24/2025-01:09:02] [I] Model: rtdetr-l.onnx [07/24/2025-01:09:02] [I] Output: [07/24/2025-01:09:02] [I] === Build Options === [07/24/2025-01:09:02] [I] Max batch: explicit batch [07/24/2025-01:09:02] [I] Memory Pools: workspace: default, dlaSRAM: default, dlaLocalDRAM: default, dlaGlobalDRAM: default [07/24/2025-01:09:02] [I] minTiming: 1 [07/24/2025-01:09:02] [I] avgTiming: 8 [07/24/2025-01:09:02] [I] Precision: FP32 [07/24/2025-01:09:02] [I] LayerPrecisions: [07/24/2025-01:09:02] [I] Layer Device Types: [07/24/2025-01:09:02] [I] Calibration: [07/24/2025-01:09:02] [I] Refit: Disabled [07/24/2025-01:09:02] [I] Version Compatible: Disabled [07/24/2025-01:09:02] [I] TensorRT runtime: full [07/24/2025-01:09:02] [I] Lean DLL Path: [07/24/2025-01:09:02] [I] Tempfile Controls: { in_memory: allow, temporary: allow } [07/24/2025-01:09:02] [I] Exclude Lean Runtime: Disabled [07/24/2025-01:09:02] [I] Sparsity: Disabled [07/24/2025-01:09:02] [I] Safe mode: Disabled [07/24/2025-01:09:02] [I] Build DLA standalone loadable: Disabled [07/24/2025-01:09:02] [I] Allow GPU fallback for DLA: Disabled [07/24/2025-01:09:02] [I] DirectIO mode: Disabled [07/24/2025-01:09:02] [I] Restricted mode: Disabled [07/24/2025-01:09:02] [I] Skip inference: Disabled [07/24/2025-01:09:02] [I] Save engine: rtdetr-l.FP32.trtmodel [07/24/2025-01:09:02] [I] Load engine: [07/24/2025-01:09:02] [I] Profiling verbosity: 0 [07/24/2025-01:09:02] [I] Tactic sources: Using default tactic sources [07/24/2025-01:09:02] [I] timingCacheMode: local [07/24/2025-01:09:02] [I] timingCacheFile: [07/24/2025-01:09:02] [I] Heuristic: Disabled [07/24/2025-01:09:02] [I] Preview Features: Use default preview flags. [07/24/2025-01:09:02] [I] MaxAuxStreams: -1 [07/24/2025-01:09:02] [I] BuilderOptimizationLevel: -1 [07/24/2025-01:09:02] [I] Input(s)s format: fp32:CHW [07/24/2025-01:09:02] [I] Output(s)s format: fp32:CHW [07/24/2025-01:09:02] [I] Input build shape: images=1x3x640x640+1x3x640x640+16x3x640x640 [07/24/2025-01:09:02] [I] Input calibration shapes: model [07/24/2025-01:09:02] [I] === System Options === [07/24/2025-01:09:02] [I] Device: 0 [07/24/2025-01:09:02] [I] DLACore: [07/24/2025-01:09:02] [I] Plugins: [07/24/2025-01:09:02] [I] setPluginsToSerialize: [07/24/2025-01:09:02] [I] dynamicPlugins: [07/24/2025-01:09:02] [I] ignoreParsedPluginLibs: 0 [07/24/2025-01:09:02] [I] [07/24/2025-01:09:02] [I] === Inference Options === [07/24/2025-01:09:02] [I] Batch: Explicit [07/24/2025-01:09:02] [I] Input inference shape: images=1x3x640x640 [07/24/2025-01:09:02] [I] Iterations: 10 [07/24/2025-01:09:02] [I] Duration: 3s (+ 200ms warm up) [07/24/2025-01:09:02] [I] Sleep time: 0ms [07/24/2025-01:09:02] [I] Idle time: 0ms [07/24/2025-01:09:02] [I] Inference Streams: 1 [07/24/2025-01:09:02] [I] ExposeDMA: Disabled [07/24/2025-01:09:02] [I] Data transfers: Enabled [07/24/2025-01:09:02] [I] Spin-wait: Disabled [07/24/2025-01:09:02] [I] Multithreading: Disabled [07/24/2025-01:09:02] [I] CUDA Graph: Disabled [07/24/2025-01:09:02] [I] Separate profiling: Disabled [07/24/2025-01:09:02] [I] Time Deserialize: Disabled [07/24/2025-01:09:02] [I] Time Refit: Disabled [07/24/2025-01:09:02] [I] NVTX verbosity: 0 [07/24/2025-01:09:02] [I] Persistent Cache Ratio: 0 [07/24/2025-01:09:02] [I] Inputs: [07/24/2025-01:09:02] [I] === Reporting Options === [07/24/2025-01:09:02] [I] Verbose: Disabled [07/24/2025-01:09:02] [I] Averages: 10 inferences [07/24/2025-01:09:02] [I] Percentiles: 90,95,99 [07/24/2025-01:09:02] [I] Dump refittable layers:Disabled [07/24/2025-01:09:02] [I] Dump output: Disabled [07/24/2025-01:09:02] [I] Profile: Disabled [07/24/2025-01:09:02] [I] Export timing to JSON file: [07/24/2025-01:09:02] [I] Export output to JSON file: [07/24/2025-01:09:02] [I] Export profile to JSON file: [07/24/2025-01:09:02] [I] [07/24/2025-01:09:02] [I] === Device Information === [07/24/2025-01:09:02] [I] Selected Device: NVIDIA GeForce RTX 4060 Ti [07/24/2025-01:09:02] [I] Compute Capability: 8.9 [07/24/2025-01:09:02] [I] SMs: 34 [07/24/2025-01:09:02] [I] Device Global Memory: 7797 MiB [07/24/2025-01:09:02] [I] Shared Memory per SM: 100 KiB [07/24/2025-01:09:02] [I] Memory Bus Width: 128 bits (ECC disabled) [07/24/2025-01:09:02] [I] Application Compute Clock Rate: 2.535 GHz [07/24/2025-01:09:02] [I] Application Memory Clock Rate: 9.001 GHz [07/24/2025-01:09:02] [I] [07/24/2025-01:09:02] [I] Note: The application clock rates do not reflect the actual clock rates that the GPU is currently running at. [07/24/2025-01:09:02] [I] [07/24/2025-01:09:02] [I] TensorRT version: 8.6.1 [07/24/2025-01:09:02] [I] Loading standard plugins [07/24/2025-01:09:03] [I] [TRT] [MemUsageChange] Init CUDA: CPU +16, GPU +0, now: CPU 24, GPU 870 (MiB) [07/24/2025-01:09:07] [I] [TRT] [MemUsageChange] Init builder kernel library: CPU +1459, GPU +266, now: CPU 1560, GPU 1136 (MiB) [07/24/2025-01:09:07] [I] Start parsing network model. [07/24/2025-01:09:07] [I] [TRT] ---------------------------------------------------------------- [07/24/2025-01:09:07] [I] [TRT] Input filename: rtdetr-l.onnx [07/24/2025-01:09:07] [I] [TRT] ONNX IR version: 0.0.10 [07/24/2025-01:09:07] [I] [TRT] Opset version: 17 [07/24/2025-01:09:07] [I] [TRT] Producer name: pytorch [07/24/2025-01:09:07] [I] [TRT] Producer version: 2.0.1 [07/24/2025-01:09:07] [I] [TRT] Domain: [07/24/2025-01:09:07] [I] [TRT] Model version: 0 [07/24/2025-01:09:07] [I] [TRT] Doc string: [07/24/2025-01:09:07] [I] [TRT] ---------------------------------------------------------------- [07/24/2025-01:09:07] [W] [TRT] onnx2trt_utils.cpp:374: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32. [07/24/2025-01:09:07] [W] [TRT] onnx2trt_utils.cpp:400: One or more weights outside the range of INT32 was clamped [07/24/2025-01:09:07] [I] Finished parsing network model. Parse time: 0.189897 [07/24/2025-01:09:08] [I] [TRT] Graph optimization time: 0.530827 seconds. [07/24/2025-01:09:08] [I] [TRT] Local timing cache in use. Profiling results in this builder pass will not be stored. symbolic_global_padding.cpp:929: DCHECK(use->is_use_only()) failed. [07/24/2025-01:11:04] [E] Error[10]: Could not find any implementation for node {ForeignNode[(Unnamed Layer* 2236) [Shuffle].../model.28/Concat_27]}. [07/24/2025-01:11:05] [E] Error[10]: [optimizer.cpp::computeCosts::3869] Error Code 10: Internal Error (Could not find any implementation for node {ForeignNode[(Unnamed Layer* 2236) [Shuffle].../model.28/Concat_27]}.) [07/24/2025-01:11:05] [E] Engine could not be created from network [07/24/2025-01:11:05] [E] Building engine failed [07/24/2025-01:11:05] [E] Failed to create engine from model or file. [07/24/2025-01:11:05] [E] Engine set up failed &&&& FAILED TensorRT.trtexec [TensorRT v8601] # /opt/TensorRT-8.6.1.6/bin/trtexec --onnx=rtdetr-l.onnx --minShapes=images:1x3x640x640 --optShapes=images:1x3x640x640 --maxShapes=images:16x3x640x640 --saveEngine=rtdetr-l.FP32.trtmodel
最新发布
07-25
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

夜流冰

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值