It's just the distinction between AI and program is very murky in 40k, muddled even further by its execution in the texts. Space Marine X believes the war spirit of his bolter's targeter locks on to threats because it knows and thinks about these things. It further anthropomorphizes it by saying stuff like "it eagerly targeted the heretic's hearts, sensing its ancient foe." Meanwhile Space Marine Y (or writer Y) talks about it more mechanical terms. A targeter does what it does because it has subroutines and logic circuits and blah blah blah sacred techno mysteries the techmarines understand.
A program for your targeter is probably ok. An artificial intelligence that knows what to do with the data is not.
Other writers treat it more clinically, dancing around what a targeter is and how it does its work. Forget how complicated managing all the systems of Space Marine power armor must be, I've always been somewhat fascinated by how small things, that aren't skull-sized, work in 40k. Like targeters. Like handheld auspex. That's where theory vs. superstition really comes head to head. I've even read it that Machine Spirits are all blends of human and machine consciousness, where the beginning of one and the end of the other aren't distinguishable anymore. No brain in a jar, so to speak.
Which is to me the most metal interpretation of 40k tech. Space Marine armor literally has the machine-soul of a venerable Space Marine to run its systems, that probably remembers every marine that's ever lived and died in that armor, who can occasionally do sentient shit like work just a little harder to get the job done before failing. I don't think 40k's execution or lack of resolution to this question is bad or flawed. I think it's actually quite brilliant.