Li Ang looked at that line of comments.

"What are you looking at?"

Wang Xu's voice came from behind.

Li Ang hurriedly turned around.

"Nothing, just looking at the comments for that patch of mine."

"Oh, that."

Wang Xu leaned against the edge of the desk and said,

"The one you wrote yourself?"

"Yes."

"Not bad."

"But that solution needs to be changed now."

Li Ang was stunned for a moment.

"Changed?"

"Yes."

"After that batch of cards from the mining boom was swept away, we got a batch sent back for factory repairs."

"They're the so-called miner dismantled cards."

"They've been running for several months, and the fan bearings are severely worn."

"But the more troublesome part is that the video memory page table shows traces of fragmentation."

Wang Xu pointed at the screen.

"Your per-block lock will generate new hotspots in high-concurrency mining scenarios."

"It's not lock contention, it's cache line bouncing."

"We need a more dynamic allocation strategy."

Hearing this, Li Ang's mind started racing.

"That means... the current solution will actually degrade under extreme high loads?"

"Yes."

"But this isn't your problem; we hadn't encountered this scenario yet when you wrote the patch."

"However, we've encountered it now."

Wang Xu patted him on the shoulder.

"So you've got work to do on your very first day on the job."

"Run this week's experimental data and give me a new solution."

Li Ang was stunned for a moment and said,

"...Okay."

"Oh, right."

Wang Xu walked to the door, turned back, and said,

"Tomorrow at noon, when we go to the cafeteria to eat, bring your draft solution."

"We can eat and chat at the same time."

After Wang Xu left,

Li Ang looked at the screen again.

His fingers rested on the keyboard, paused for two seconds, and then he started typing.

He wasn't writing code; he first opened a blank document and wrote the first line:

Problem: Analysis of cache line bouncing for per-block locks under extreme high-concurrency scenarios.

...

The next day, at ten past twelve noon, in the Xinghan Semiconductor cafeteria.

Wang Xu carried his meal tray and sat down at the table in the corner. Li Ang followed over, opened his laptop, and turned the screen toward Wang Xu.

"Eat first."

Wang Xu picked up a chopstick full of greens, his eyes already falling on the screen.

Li Ang didn't even bother to grab his chopsticks, directly swiping his finger across the touchpad.

"I ran the data from the returned mining cards last night."

"A total of four cards ran continuously for 97 days. After exporting the video memory allocation logs, I found that the issue with the per-block lock isn't lock contention itself."

"Instead, adjacent blocks frequently and alternately request and release, which causes the same cache line in the L2 cache to repeatedly invalidate."

Wang Xu swallowed the food in his mouth, nodded, and said,

"Go on."

"So I came up with an idea."

"That is, instead of changing the lock granularity, we change the allocation affinity."

"Pre-allocate a block pool for each compute queue. The blocks within the pool only circulate inside the queue, and cross-queue requests will trigger the global allocator."

"This way, most requests don't go through locks at all, and cache bouncing naturally disappears."

Hearing this, Wang Xu put down his chopsticks and stared intently at the screen for half a minute.

"How should we determine the size of the pre-allocated pool?"

"You know, the video memory demands of different shaders vary greatly; if you give too little it's not enough, and if you give too much it's a waste."

"We can use runtime profiling to dynamically adjust it."

"I wrote a rough estimate."

"Sample the average block demand of each queue every 100ms, take the 95th percentile multiplied by 1.2 as the pool size. It won't shrink below the threshold, and it will expand above the threshold."

"I've calculated the overhead; it accounts for about 0.4% of the scheduler's total time."

Wang Xu was silent for a few seconds, then suddenly smiled.

"What time did you get home last night?"

Hearing this, Li Ang was stunned for a moment, seemingly not expecting Wang Xu to ask something unrelated to work.

"Uh... a little past two, I guess."

"What time did you come this morning?"

"Half past seven."

"It's only your first day on the job, and you're already pushing yourself this hard?"

Wang Xu's lips curved up slightly.

"Alright, I approve of the solution."

"But there's one place that needs to be changed: multiplying the 95th percentile by 1.2 is still too conservative."

"In a mining boom scenario, sudden traffic might break through it."

"So change it to the 99th percentile multiplied by 1.5, and add an emergency overflow path. If the pool is full, go directly to the global allocator and don't let the queue block."

Hearing this, Li Ang quickly wrote it down.

"Also, your profiling sampling interval of 100ms is too long."

"In mining card scenarios, 100ms is enough for multiple violent fluctuations to occur."

"So change it to 10ms, and recalculate the overhead."

"Okay."

"Implement the prototype today, and show me the results tomorrow morning."

"If it runs successfully, we'll merge it into v1.3."

...

Wang Xu picked up his chopsticks again; the food had already grown cold.

However, he didn't mind and started eating in large mouthfuls directly.

Li Ang closed his laptop and also picked up his chopsticks.

He lowered his head and shoveled a mouthful of rice, feeling his stomach empty.

But he hadn't eaten a single bite since last night, and his mind was full of code.

"Engineer Wang."

"Hmm?"

"I want to know, why did you choose me?"

Li Ang asked directly.

"When I submitted my resume back then, I actually didn't hold out much hope."

"I'm from South University of Technology, not Peking University, nor Tsinghua University."

"Although there are already few people in the direction of graphics, I feel that I... uh... am not among the top-tier batch."

Wang Xu chewed the food in his mouth until he swallowed it before speaking.

"Do you know how many people are in our GSG scheduling team right now?"

"Uh... I don't know."

"Counting you, six."

Hearing this, Li Ang was stunned once again.

"In the whole of Shenzhen, Xinghan's GPU drivers add up to less than thirty people."

"You must know that currently, there are very few people in China doing this direction."

"It's not that people don't want to do it, but schools don't teach it, enterprises don't recruit for it, and there is no ecosystem to speak of."

"So no one is willing to spend three to five years gnawing on something with no visible return."

Wang Xu looked at him.

"But you're different."

"After seeing GSG's open-source code, you didn't go copy APIs to write upper-layer applications."

"Instead, you dug straight into the video memory allocator to look for bugs."

"When you submitted the patch, no one was urging you by your side, there was no KPI, no bonus—you just felt there was a problem here, and then you went and fixed it."

"And in my eyes, this is more important than the school brand."

Li Ang didn't speak, lowering his head to shovel rice.

"And..."

Wang Xu paused and said,

"President Jiang once said something that I've always remembered."

"He said, what we want is not 'people who are already very strong', but 'people who are willing to grind it out to the death in the hardest places'."

"The former can be bought with money, but the latter cannot."

People came and went in the cafeteria, and the noisy sounds covered up a lot of things.

But Li Ang heard this sentence clearly.

After finishing the meal, Wang Xu stood up.

"At two o'clock in the afternoon, team meeting, you come too."

"Present your solution and let the others pick out flaws."

"Okay."

...