I fixed my Desync/input Lag/Hitreg in CSGO

Everything about latency. Tips, testing methods, mouse lag, display lag, game engine lag, network lag, whole input lag chain, VSYNC OFF vs VSYNC ON, and more! Input Lag Articles on Blur Busters.
ManWhoSoldTheWorld
Posts: 3
Joined: 18 Jun 2021, 18:58

Re: I fixed my Desync/input Lag/Hitreg in CSGO

Post by ManWhoSoldTheWorld » 20 Sep 2023, 10:57

dougg0k wrote:
19 Sep 2023, 23:53
KingAzar wrote:
19 Sep 2023, 23:43
dougg0k wrote:
19 Sep 2023, 21:04
You should read my last post before this one instead of doing what you are doing.
Sure, thanks for steering us in this direction, but I believe our attention is primarily centered on this specific post and the outcome it produced:
dougg0k wrote:
18 Sep 2023, 20:43
I didnt tested in CS, but I can certainly say that today I have truly solved this sort of problem, so far at least in Overwatch 2, in my machine. With results I have never experienced before. I left all comments about how I did in my interrupt affinity auto file. Though I think this will be for every game.

It's been consistent across different ranked matches.

https://github.com/dougg0k/gaming_os_tw ... o.ps1#L233
At this point, you're mentioning your PowerShell script line 233, and some of us are still closely following it with the assumption that we just need to run that PS script. If we seem to be making mistakes, please specify where we're going wrong and provide clear instructions instead of leaving us to guess which post you displayed. Keep in mind that some of the people here lack expertise and are simply gamers attempting to resolve that people on the forum are facing. That said we all here appreciate your results and solutions.
I understand, but you can now ignore that older post and use that one that I mentioned, because changes were made and better clarification were provided.

If you want to know what to execute, depending on what you have, only network.cmd script would be enough, but you can also execute the interrupt affinity auto script if you want, based on what you devices have support for.
I think you did a great job explaining which change the readers of the forum should've looked into. Excellent information! Really enjoyed reading through your GitHub :-)

KingAzar
Posts: 117
Joined: 28 Dec 2022, 00:54

Re: I fixed my Desync/input Lag/Hitreg in CSGO

Post by KingAzar » 20 Sep 2023, 11:14

[email protected] wrote:
20 Sep 2023, 04:18
Can someone screenshot the "MSI mode utility" tool with the settings, which dougg0k is setting with his script?

PLEASE!
2023-09-20 10_14_19-MSI mode utility.png
2023-09-20 10_14_19-MSI mode utility.png (49.5 KiB) Viewed 5292 times

dougg0k
Posts: 65
Joined: 06 Jun 2023, 12:11

Re: I fixed my Desync/input Lag/Hitreg in CSGO

Post by dougg0k » 20 Sep 2023, 11:56

That alone doesnt not do almost anything. If you read my later post, you would see that, that is not the main thing.

---

Now to a different subject. I have been reading a bit more about Interrupts and the Line based IRQ interrupts being the legacy ones, there seem to be a way to disable it while also not having MSI enabled.

https://community.intel.com/t5/FPGA-Wik ... a-p/736044
https://docs.xilinx.com/r/en-US/pg054-7 ... t-Requests

I started looking it up what could happen if that were to happen. I found no answer, and I end up looking it up using chatgpt, and it gave me an answer.

Here is the trimmed response from the AI
Disabling Legacy Interrupts can potentially bring benefits in certain specialized situations, but it's important to understand that these benefits come with trade-offs and should be carefully considered based on your specific use case. Here are some scenarios where disabling Legacy Interrupts might provide benefits:

1. **Performance Optimization**: In some cases, disabling Legacy Interrupts can lead to marginal performance improvements, especially in high-performance computing (HPC) or real-time systems. This is because Legacy Interrupts can introduce some overhead due to their older design.

2. **Reduced Latency**: Disabling Legacy Interrupts may reduce interrupt latency, which can be critical in real-time applications where low-latency responses are essential. However, modern interrupt handling mechanisms like the Advanced Programmable Interrupt Controller (APIC) are generally more efficient in handling interrupts with low latency.

It's important to emphasize that these potential benefits are relatively narrow in scope and may not apply to typical desktop or server systems running modern operating systems. Disabling Legacy Interrupts can lead to compatibility issues with older hardware and software, which can outweigh any potential performance gains. Additionally, many modern systems and operating systems are designed to handle interrupts efficiently, and Legacy Interrupts are rarely a significant bottleneck.

Before disabling Legacy Interrupts, you should thoroughly understand the implications for your specific hardware and software environment and have a clear reason for doing so. In most cases, it's advisable to leave Legacy Interrupts enabled unless you have a compelling and well-documented reason to disable them.
I asked if that would mean processing in realtime.
Disabling legacy interrupts will not inherently result in processing in real-time. Real-time processing involves ensuring that a system or application responds to events and tasks within a guaranteed and deterministic time frame, meeting specific deadlines. Disabling legacy interrupts alone does not automatically grant real-time capabilities to a system; it's just one factor among many that might affect system responsiveness.

Legacy interrupts refer to older interrupt mechanisms used in x86-based systems, and disabling them might reduce interrupt latency to some extent. However, achieving real-time performance requires a more comprehensive approach:

1. **Real-Time Operating System (RTOS)**: Real-time processing often relies on a specialized Real-Time Operating System (RTOS) that is designed to provide predictable and deterministic response times to tasks and events. RTOSes are optimized for real-time applications and can manage hardware and software resources accordingly.

2. **Priority Scheduling**: Real-time systems use priority-based scheduling to ensure that higher-priority tasks preempt lower-priority ones, allowing critical tasks to be processed promptly.

5. **Interrupt Management**: While disabling legacy interrupts might reduce interrupt latency, real-time systems often rely on a well-managed interrupt system that efficiently handles interrupts for critical tasks. This may involve configuring and optimizing interrupt handlers for real-time responsiveness.

In summary, while disabling legacy interrupts might be one aspect of optimizing a system for lower interrupt latency, achieving true real-time processing involves a holistic approach that encompasses the entire system design, including the use of an RTOS, priority scheduling, deterministic code, and careful hardware and software considerations.
It's a direction to further minimize latency. If people are interested in looking it up further. It would also probably mean making memory changes as to disable it, at least I dont know any other way that would be possible currently.

As for the instant processing answer.
Disabling both MSI (Message Signaled Interrupts) and INTx (legacy interrupt) mechanisms can simplify the interrupt delivery process, but it doesn't guarantee "instant" interrupt processing. There will still be some inherent latency associated with handling interrupts, even with both mechanisms disabled.

Interrupt processing typically involves several steps, such as saving the CPU's current state, jumping to the interrupt handler code, executing the handler, and eventually restoring the saved state. These steps introduce some delay, and disabling MSI and INTx interrupts only removes some of the complexities and potential sources of delay in the delivery mechanism.

The actual processing time for an interrupt also depends on factors such as the efficiency of the interrupt handler code, the priority of the interrupt, and the system's overall load. High-priority interrupts, for example, may be processed more quickly than lower-priority ones.

While you can optimize and streamline the interrupt handling process by disabling MSI and INTx, it won't result in "instant" interrupt processing, as some level of latency is inherent to the way CPUs and operating systems handle interrupts. The goal is to minimize this latency as much as possible, but achieving true instant processing in the context of interrupts may not be feasible due to the underlying hardware and software constraints.
---

AI shared a possible way to deactivate INTx (legacy interrupt) and I actually tried with the ethernet device, it just vanish when I did, but since it's a memory change, after a restart, it came back normally.

I dont recommend trying this but I will share here the command and tool.

setpci -s 01:00.0 4.w=0x0000
https://eternallybored.org/misc/pciutils/

01:00.0 is the device address that you have to change from the device you want to make the change on.

In the same zip, there are two executables, one you would use to check the address of the device (lspci.exe), and the other to set (setpci.exe).

dougg0k
Posts: 65
Joined: 06 Jun 2023, 12:11

Re: I fixed my Desync/input Lag/Hitreg in CSGO

Post by dougg0k » 20 Sep 2023, 17:27

KingAzar wrote:
19 Sep 2023, 20:38
I got the same:

2023-09-19 19_36_42-Administrator_ Windows PowerShell.png

Also, I have 13900K, why isn't put on separated cores for each component?
I left a bunch of comments in the top of the script, that should give explanations to related issues that you've asked. Of course the script could be improved to different devices, choices and even CPUs. To myself it works exactly as I need it.

But for improvements to happen, that would require git contributions to it, I dont have more time to work on it.

User avatar
F1zus
Posts: 134
Joined: 07 Nov 2022, 17:59

Re: I fixed my Desync/input Lag/Hitreg in CSGO

Post by F1zus » 20 Sep 2023, 17:54

dougg0k wrote:
20 Sep 2023, 11:56

AI shared a possible way to deactivate INTx (legacy interrupt) and I actually tried with the ethernet device, it just vanish when I did, but since it's a memory change, after a restart, it came back normally.

I dont recommend trying this but I will share here the command and tool.

setpci -s 01:00.0 4.w=0x0000
https://eternallybored.org/misc/pciutils/

01:00.0 is the device address that you have to change from the device you want to make the change on.

In the same zip, there are two executables, one you would use to check the address of the device (lspci.exe), and the other to set (setpci.exe).
I tried disabling INTx for the network card and in my opinion nothing happened, the card was still displayed in the MSI mode utility with all modes (lbi, msi, msi-x).
Then I entered the command to disable the INTx USB controller and it simply disappeared from the system. My mouse has stopped working. After a reboot everything returned.
Now I'll try disabling INTx for the network card and audio card and play a few matches in CSGO. Let's see if this gives an advantage.

UPD:
I entered the command for the network card again and it disappeared from the system for a few seconds, then appeared again. Now I'm starting the game to feel the changes.

dougg0k
Posts: 65
Joined: 06 Jun 2023, 12:11

Re: I fixed my Desync/input Lag/Hitreg in CSGO

Post by dougg0k » 20 Sep 2023, 20:03

F1zus wrote:
20 Sep 2023, 17:54
dougg0k wrote:
20 Sep 2023, 11:56

AI shared a possible way to deactivate INTx (legacy interrupt) and I actually tried with the ethernet device, it just vanish when I did, but since it's a memory change, after a restart, it came back normally.

I dont recommend trying this but I will share here the command and tool.

setpci -s 01:00.0 4.w=0x0000
https://eternallybored.org/misc/pciutils/

01:00.0 is the device address that you have to change from the device you want to make the change on.

In the same zip, there are two executables, one you would use to check the address of the device (lspci.exe), and the other to set (setpci.exe).
I tried disabling INTx for the network card and in my opinion nothing happened, the card was still displayed in the MSI mode utility with all modes (lbi, msi, msi-x).
Then I entered the command to disable the INTx USB controller and it simply disappeared from the system. My mouse has stopped working. After a reboot everything returned.
Now I'll try disabling INTx for the network card and audio card and play a few matches in CSGO. Let's see if this gives an advantage.

UPD:
I entered the command for the network card again and it disappeared from the system for a few seconds, then appeared again. Now I'm starting the game to feel the changes.
Who knows if the command are 100% accurate. Someone would need to find the register documentation to know.

That command is bus number 01, device number 00, and function number 0 at offset 4, set register value to 0x0000. What would need accuracy is the offset, probably.

[email protected]
Posts: 35
Joined: 22 Dec 2022, 15:50

Re: I fixed my Desync/input Lag/Hitreg in CSGO

Post by [email protected] » 21 Sep 2023, 03:26

dougg0k wrote:
20 Sep 2023, 11:56
That alone doesnt not do almost anything. If you read my later post, you would see that, that is not the main thing.
Please don't be so mysterious. Please explain specifically in individual steps how to achieve the same result without the script.


EDIT:

I've read up on the "interrupt" topic a bit, but as an amateur I still don't have much knowledge of IRQ, MSI, MSI-X, Legacy Interrupt.

In my opinion the interrupts interfere with each other. Consequently, the solution would be to select different channels for each hardware (graphics card, network card, sound card, USB) and switch to a continuous signal mode to different CPU cores.

This way you would have the least delay.

Someone else has to answer whether this is even possible. It´s an idea for a solution.

dougg0k
Posts: 65
Joined: 06 Jun 2023, 12:11

Re: I fixed my Desync/input Lag/Hitreg in CSGO

Post by dougg0k » 21 Sep 2023, 13:13

Nothing mysterious there, explanations were given, reading what I wrote is what it didnt happen.

dougg0k
Posts: 65
Joined: 06 Jun 2023, 12:11

Re: I fixed my Desync/input Lag/Hitreg in CSGO

Post by dougg0k » 24 Sep 2023, 18:55

From what I have been writing here and have experienced, I think the secret that is not really a secret, just less known, to fixing hit reg issues, is tweak everything that is possible, to help packets be processed faster.

cursed-gamer
Posts: 80
Joined: 16 Aug 2023, 13:07

Re: I fixed my Desync/input Lag/Hitreg in CSGO

Post by cursed-gamer » 24 Sep 2023, 19:05

All games suppose to work just fine after plug and play. You have no idea how many players have zero knowledge about any configurations and "wInDoWs TwEaKs" and they are able to perform very well ingame.

Post Reply