Are you using Clover or OpenCore as your bootloader?
When using Clover you can add the following patch to the Kext and Kernel Patches section of your config.plist to enable trim.
View attachment 554214 Select Enable Trim from drop down menu in Clover Configurator
Remember to unselect the Disable patch option, which is automatically enabled when this patch is selected in Clover Configurator.
View attachment 554215 View attachment 554216
In OpenCore the process can be a little more complicated, in that you may need to set a time for the trim action to work, this can effect the time it takes to boot your system from a cold start.
The screenshot below contains the information provided by the OpenCore developers in their OC Configuration guide, which starts on page 35 in the Configuration.pdf for OC 0.8.3.
View attachment 554217 SetApfsTrimTimeout & ThirdPartyDrives options.
Enabling the ThirdPartyDrives option in your config.plist should enable the Trim option.
Setting a timeout figure in the SetApfsTrimTimeout entry will give OC more chance of fully completing the Trim command, this may make the boot time longer, depending on when you last ran the Trim command on your SSD.
Have a careful read of the information above and see what you make of it.
You can of course change the SetApfsTrimTimeout entry from say '4294967295' back to '-1', once you are sure the Trim command has been completed on your SSD. So it is only run as and when you choose to change the setting.
This of course assumes you are not running macOS Monterey, as the trim command stopped working in Monterey.