How to overclock a nvidia optimus gpu?

I’ve heard that it’s possible and that there is a way for only nvidia gpu but when I try it X just fails to start and I get a black screen. The only way to fix it is to remove the X11 config form tty and reboot.

So is overclocking possible on optimus and if it is how?

Inxi -F

  Host: vidakov-laptop Kernel: 5.17.15-1-MANJARO arch: x86_64 bits: 64
    Desktop: KDE Plasma v: 5.24.5 Distro: Manjaro Linux
  Type: Laptop System: HP product: HP Pavilion Laptop 15-eg0xxx
    v: Type1ProductConfigId serial: <superuser required>
  Mobo: HP model: 8850 v: 34.27 serial: <superuser required> UEFI: Insyde
    v: F.11 date: 01/15/2021
  ID-1: BAT0 charge: 40.2 Wh (100.0%) condition: 40.2/40.2 Wh (100.0%)
  Info: quad core model: 11th Gen Intel Core i7-1165G7 bits: 64 type: MT MCP
    cache: L2: 5 MiB
  Speed (MHz): avg: 2604 min/max: 400/4700 cores: 1: 1296 2: 1502 3: 3632
    4: 3512 5: 3018 6: 3903 7: 2374 8: 1602
  Device-1: Intel TigerLake-LP GT2 [Iris Xe Graphics] driver: i915 v: kernel
  Device-2: NVIDIA TU117M [GeForce MX450] driver: nvidia v: 515.48.07
  Device-3: Luxvisions Innotech HP Wide Vision HD Camera type: USB
    driver: uvcvideo
  Display: x11 server: X.Org v: 21.1.3 with: Xwayland v: 22.1.2 driver: X:
    loaded: modesetting,nvidia gpu: i915 resolution: 1920x1080~60Hz
  OpenGL: renderer: Mesa Intel Xe Graphics (TGL GT2) v: 4.6 Mesa 22.1.2
  Device-1: Intel Tiger Lake-LP Smart Sound Audio
    driver: sof-audio-pci-intel-tgl
  Sound Server-1: ALSA v: k5.17.15-1-MANJARO running: yes
  Sound Server-2: PulseAudio v: 16.1 running: yes
  Sound Server-3: PipeWire v: 0.3.52 running: yes
  Device-1: Realtek RTL8822CE 802.11ac PCIe Wireless Network Adapter
    driver: rtw_8822ce
  IF: wlo1 state: up mac: 64:6c:80:26:38:43
  Device-1: Realtek Bluetooth Radio type: USB driver: btusb
  Report: rfkill ID: hci0 rfk-id: 2 state: down bt-service: enabled,running
    rfk-block: hardware: no software: yes address: see --recommends
  Hardware-1: Intel Volume Management Device NVMe RAID Controller driver: vmd
  Local Storage: total: 476.94 GiB used: 305.92 GiB (64.1%)
  ID-1: /dev/nvme0n1 vendor: Intel model: SSDPEKNW512G8H size: 476.94 GiB
  ID-1: / size: 468.09 GiB used: 305.92 GiB (65.4%) fs: ext4
    dev: /dev/nvme0n1p2
  ID-2: /boot/efi size: 299.4 MiB used: 288 KiB (0.1%) fs: vfat
    dev: /dev/nvme0n1p1
  ID-1: swap-1 type: file size: 512 MiB used: 0 KiB (0.0%) file: /swapfile
  System Temperatures: cpu: 55.0 C mobo: N/A
  Fan Speeds (RPM): cpu: 0 fan-2: 0
  Processes: 244 Uptime: 9h 42m Memory: 15.4 GiB used: 3.05 GiB (19.8%)
  Shell: Zsh inxi: 3.3.19

Edit: I’m also trying to overclock the gpu with green with envy

Just tried it doesn’t work I just get a black screen and sddm fails to start and I have to remove the xorg.conf file in /etc/X11/ to get it to work again. Anyway thanks for the idea.