AI progress

I have for some time been complaining that progress in many fields peaked around 1972 or so, that many important fields have gone backwards. Last man on the moon 1972, cars and clothes washing machines have been getting crappier. The skyline on big western cities is starting to look less and less like the future, as is the interior of your neighbourhood shopping mall. The highest flying and fastest flying warplane retired in the early eighties.

But there has been a major breakthrough in AI. The methods proposed in “attention is all you need” have been applied to a variety of problems, and are yielding interesting, important, and impressive results.

The breakthrough is that generative techniques can generate endless instances as instantiations of a word, or set of words, and can also recognise a particular instance as an instantiation of a word or words. In other words, handles words as reference to concepts.

This has been the show stopper problem in philosophy, ai, and the philosophy of ai for a long time. That GPT works as well as it does tells us something important about meaning, thought, and words. What it is telling us is not clear, but whatever it is telling us, it is a reply to an issue first raised by Aristotle.

GPT type models can generate an unlimited number of instances corresponding to a concept or set of concepts, and can recognize the goodness of match of a particular instance to concept or set of concepts. Or at least is acting like it can in some important cases, quite a lot of important cases.

What we could do with this tool is take an enormous pile of conversations, and for each entity in the conversation, predict his response to any previous comment.

The question then is, would a generated conversation indicate a sentient response to novel prompts?

One of the things gpt can do is represent a very large body of knowledge, by predicting the response to a query about it from existing similar, but far from identical, queries.

But because it does not understand the information it is representing, the responses suffer from “hallucination” reflecting the fact that its model of the knowledge is not the knowledge, but a model of words about the knowledge, words about words. Sometimes, they superficially sounded very like a correct answer but were utter nonsense.

ChatGPT makes errors because its universe consists of words referring to words. Its errors do not necessarily reveal a lack of consciousness, but rather reveal it does not understand the words refer to real physical things.

When it makes a completely stupid error, and gives a meaningless nonsense response, it sounds very like a sensible and correct response, and you have to think about it a bit before you realise it is utter nonsense and meaningless gibberish.

ChatGPT is very very good at writing code. Not so good at knowing what code to write.

Suppose it had been trained on words referring to words, and on words referring to diagrams, and on diagrams and words referring to twodee and threedee images, and on words, diagrams, two dee and three dee images referring to full motion videos.

From the quality of the performance on words about words, and words about artistic images, one might plausibly hope for true perception. What we now have is quite clearly not conscious. But it has taken an impressively large step in the direction of consciousness. We have an algorithm that successfully handles the long standing central big hard problem in philosophy, AI, and the philosophy of AI, at least in a whole lot of useful, important, and interesting cases.

Quite likely we will find it only handles a subset of interesting cases. That is what happened with every previous AI breakthrough. After a while, people banged into the hard limits that revealed no one at home, that consciousness was being emulated, but not present. People anthropomorphise their pets, because their pet really is conscious. They do not anthropomorphise their Teslas, because the Tesla really is not, and endlessly polishing up the Tesla’s driving algorithms and giving the more computing power and data is not getting them any closer.

But we are not running into hard limits of GPT yet.

Perception is starting to look soluble. Not solved, but definitely looking like a solution may well be merely a matter of polishing up what we now have.

Will, intent, purpose, and desire still conspicuously missing. But they are problems very similar to perception, hard in the same way and for the same reasons perception is hard.

We do not yet have a robot that can take a beer out of a fridge, pop open the can and pour me a drink, or can fold a shirt in a reasonable time. And the way the wind blows, we are likely to get an AI that knows all the knowledge in the world, and can provide meaningful and useful answers about it before we can get a robot that can make me a ham sandwich. But it now starting to look a whole lot more likely that we can get an AI that knows all the knowledge in the world and can provide meaningful and useful answers.

1,104 comments AI progress

Mister Grumpus says:

Get this:

On Feb 25th 2023 Donald Trump Junior tweeted:

“Ukraine is the Left’s new religion (high priest Zelensky), replacing COVID mandates (high priest Fauci), which replaced global warming (high priestess Greta Thunberg)”

https://twitter.com/DonaldJTrumpJr/status/1629465109310455809

I don’t understand what the hell is taking these guys so long, but to me, that’s definitely a “wow”.

Adam says:

We’ll see what he and his father does differently if anything. The thing that trips me up about Don Jr. (the same with his father as well) is that he is too concerned about the proles. But the proles are always going to be downstream of the success of their rulers, so you don’t need to pander to them. You just need to succeed. It’s a sort of over-socialization I guess that comes with liberalism. I’m sure he’s a decent man and all I hope this is a sign that they are learning something.

alf says:

The meme that the left is religious has really blown up in the mainstream right. Which is good, because it’s our meme.

But it’s still tricky. We took that meme to say: ‘look, we’re always ruled by a state religion. So let’s make it official.’ But many in the mainstream right take it to mean: ‘our ancestors wisely fought for a division between church and state, and now the leftist church has crept back in. The dems r the real religionists!’

jim says:

Gab is run by a Christian Nationalist who knows you have to bring a gun to gunfight and a faith to a holy war. And, until they started massively rigging the Republican primaries, Christian Nationalists with that meme were winning the primaries.

alf says:

Torba seems like a guy who has got it together. I hope he sees the value in your ideas.

Jehu says:

The truth that either you are the religion that at least mildly persecutes other religions in the public sphere, or you are a religion that gets persecuted is a bitter pill for most normies. I don’t know whether they can swallow it.

A lot of the better people really just want to live and let live, but that unfortunately isn’t an option. Many people who would be classed as small l libertarians are that way, and that’s a big strain in the American population. It takes a lot for them to learn that if you want to be mostly left the hell alone, you need some serious jackboots to get there.

Adam says:

I’ve learned a similar lesson among the working class, and it’s a lesson I am continuing to learn. Either your pushing people around getting them to work for you, or your getting pushed around working for someone else. Best that one can work for or become is a generous alpha. People hate being pushed around and made to pull more weight, but if you do it and give them bonuses and such they will stick around. They might not like you but money talks. Everyone wants to prosper, and the smart ones don’t mind being made to do it.

alf says:

Here’s one I like to drop here: Yes, Everyone on the Internet Is a Loser.

tldr: he makes the point that there’s no such thing as a ‘healthy internet community.’

To which my immediate mental retort as an average Jim’s Blog enjoyer is: I guess this place does not exist. But since it does, he’s wrong.

Yet it’s not like he’s totally out of order. It’s been my experience that near to all internet communities have a hard time standing the test of time, for whatever reason. Like it has something to do with it feeling unreal? Which is kind of the point he makes as well.

Even this place sometimes feels like I am telegraphing in my comments through an electric wire. Which don’t get me wrong, I am very happy with, I was just wondering what the opinions on this are.

jim says:

Way back, Usenet died. And what it died of was, starting with the Green Card lawyers, shills.

https://reaction.la/security/social_networking.html

Usenet was designed for conversations, but was hijacked by Harvard and the New York Times to give one way lectures, resembling those given in Harvard and the pages of the New York Times. Speaking back was pointless, no one was listening, and eventually everyone stopped speaking back, and Usenet died.

The conversation in the Usenet science fiction and fantasy groups died, because the shills would stick to script no matter what, providing the superficial simulation of a conversation about fantasy and science fiction without the substance of a real conversation. And the same was happening in every Usenet group, though what was being shilled varied from one group to the next, with an immense multitude of different shilling organizations running an immense multitude of unresponsive scripts promoting an immense multitude of different scams, most of them about money rather than politics.

For a place to be not overrun, has to have effective moderation. If you don’t have a means of stopping one way broadcasts into a medium designed for conversations, your social net is going to be flooded with one way broadcasts.

alf says:

I forget how you have https://reaction.la/security/ just hidden away in your repository. Seems like it could be added to the mandatory Jim reading list. Or at least added to your back-up? I can’t find it in the current back up at least.

jim says:

Not yet ready for publication. Still organising it.

TheDividualist says:

You did not even mention Eternal September? Is ES a lie?

jim says:

It is a polite iie. Eternal September began with the Green Card Lawyers – with the discovery that you could push one way broadcasts into a medium designed for conversations.

Kunning Druegger says:

I don’t remember where I read this, but I distinctly recall reading about how Eternal September was just a later and well remembered nail in a coffin that had been built earlier. This tracks with many different online fora; when I first found /b/ in 2011/12, it was like Gondor if Sauron had decided to march east instead of West. So many stories of past habbenings, all these arcane references and rituals, and no one left but the stewards who couldn’t hold a candle to their Numenorean betters. Fast forward to 2016 and people are speaking fondly of the “good o’l days of 2012 and how everything is just cancerous now. And here we are in 2023, and I bet you could go on /b/ right now and find “le ebbin /b/ bread” that has a bunch of screencaps from 2018/19.

There have been better and worse times on 4chan, I’m not at all saying it’s inverse whig history. M00t honoring the DMCA request for Jennifer Lawrence’s cunt pictures was the real death of that site, and a blow from which Mr. Poole never recovered. But I think it could be salvaged and returned to its former glory. In fact, it would be a very interesting case study for Jimian Christianity as a management methodology. I know in the real world, the place is just a fed filtering and aggregating site, just as Black Hat and Defcon have become little more than Freddy Fed’s Fantabulous Job Fair and Anal Bead Emporium. But one can indulge a bit of misplaced optimism and daydream about a rebirth of actual internet after the Days of the Rake, Rope, and Pillow.

Redbible says:

Something worth noting is that each commenter on this blog has a window of when they will comment, and when they don’t. Even if the “commenting” schedule is irregular, no one is sitting around here posting for hours on end. Everyone here is doing other things in their life. That is an important thing for a healthy online community.

alf says:

True. The reverse seems true in many online communities; the incentives are often so that posting more equals higher status, so you get ‘discord mod’ situations where the no-lifers have the highest status.

Kunning Druegger says:

Wow, cool it with the personal attacks, bro.

c4ssidy says:

“Multi-hyphenate tech guy Elon Musk is apparently seeking to rival OpenAI, the firm he co-founded and subsequently left, with his own anti-“woke” artificial intelligence.
According to a scoop by The Information, the Twitter, Tesla, and SpaceX CEO has been reaching out to AI researchers about building a competitor to ChatGPT after publicly criticizing the chatbot built by the firm he left in 2018 over apparent ideological differences.”

“While Musk has at times lauded the power of the game-changing chatbot from his old AI group since its release last November, he has also repeatedly taken to Twitter to trash it, especially for being “woke.”
“The danger of training AI to be woke — in other words, lie — is deadly,” Musk tweeted in December.”

C4ssidy says:

“OpenAI CEO Sam Altman warns that other A.I. developers working on ChatGPT-like tools won’t put on safety limits—and the clock is ticking“

“A thing that I do worry about is … we’re not going to be the only creator of this technology,” he said. “There will be other people who don’t put some of the safety limits that we put on it. Society, I think, has a limited amount of time to figure out how to react to that, how to regulate that, how to handle it.”

“We also need enough time for our institutions to figure out what to do,” he wrote. “Regulation will be critical and will take time to figure out…having time to understand what’s happening, how people want to use these tools, and how society can co-evolve is critical.”

“ Altman grew up in St. Louis, Missouri; his mother is a dermatologist. He received his first computer at the age of eight.[5] He was born into a Jewish family.[6]”

S says:

He is talking out of both sides of his mouth. He is aware of the ‘Abolition of Man’ aspect of AI from Less Wrong, but AI safety was skin-suited by the woke.

It doesn’t matter anyway. Wu Dao (the Chinese equivalent) means we have passed the point of no return for adoption.

jim says:

The effective size of Wu Dao is about one fortieth of GPT3, though it uses a different technology, which makes comparisons not very meaningful.

One of the limits of GPT3 is that it loses track of the conversation after it grows beyond a relatively short length, somewhat less than 2048 words. No short term memory. In theory, the Wuo Dao approach could deal with longer conversations. With the Wu Dao approach, you could have a learning model running that learns about this interaction with this user, and/or with this activity, and/or about interaction on this subject matter. I don’t know if they have successfully accomplished that. They certainly want to accomplish that. To do that in a way that is actually useful, you are going to need something bigger than GPT3, and Wuo Dao is not big, though it still a lot bigger than an individual or quite small group could produce.

Pseudo-Chrysostom says:

In a turn of events befitting of our most current of years, there was a brief renaissance of procedurally generated content when tools like AI Waifu, AI Dungeon, and NovelAI dropped.

As you might expect, given that there is a huge population of aimless young men who are both horny and lonely, these drew considerable interest.

Their utility functions were largely defined by user feedback, who would regenerate output sections until they got one they wanted, give ratings to responses, and so on. Over time remarkable degrees of verisimilitude were achieved with relatively small resources on the back end.

Of course, when such things came to the attention of gnostic killjoys who hate the idea of people having things they enjoy, they were ‘shocked and appalled’ by these developments, and were quick to put pressure on hosts. Character profiles representing figures were lobotomized, ‘explicit’ content censored with hamhanded crimestop that ended up hamstringing everything else, et cetera et cetera. Models with tens of thousands of effective man hours put into them collectively, all down the drain.

jim says:

An NVIDIA tensor core GPU, which is expensive, but within reach of private individuals, can run this sort of AI. With the Cathedral cracking down on AI, because of its propensity to commit thought crimes, the the solution is open source models, and an art system that can learn from user feedback – user feedback that could both say in words what is wrong with the image, and also mark areas on the image as bad.

Current implementations fail to learn from user feedback. If someone implemented a system that could handle user feedback correctly, and gave the world access to it, it would likely become very good in time.

However, you cannot do something like GPT3 on consumer hardware. And the big money required means that a state will get its hand in.

Yandex search used to suck, but now it is delivering much better results than Global American Empire controlled search engines. I hope that Russia does, or permits, something similar to GPT3.

f6187 says:

From Daniel Lemire, “Can GPT pass my programming courses?”:

https://lemire.me/blog/2023/03/22/can-gpt-pass-my-programming-courses/

So it’s writing credible code without benefit of consciousness, but it might be manipulating actual concepts.

simplyconnected says:

The original Ai winter is coming blog, makes a couple of interesting points, namely that measures of performance comparing people and AI (say counting classification errors) can be misleading because it disregards the nature of the error. (The classic example is imageNet, where human performance is often poor because most people don’t know 20 kinds of mushrooms or the exact breeds of dogs).

The AI can get the right answer for the wrong reason (e.g. it can notice that pictures of tanks have overcast skies, then learns to tag overcast pictures as “tank”). The AI can also make different kinds of mistakes than people: not all mistakes being equally important. For example, it can make catastrophic mistakes in cases where absolutely no sane person would (would we let the AI control a nuclear plant if the very rare case when the AI causes the plant to blow up is not understood?). Which makes systems with no understanding dangerous if they are to drive cars or fly planes. (The classic example being the tesla that crashes into a white truck killing the passenger: the AI system didn’t know what it was, whereas a person driving into an obstacle would avoid it even if the nature of the obstacle isn’t fully understood).
Similarly, chatGPT ultimately needs a person to check its output for mistakes, since it cannot distinguish fact from fiction.

tl;dr We may ultimately find that lack of actual understanding limits AI’s real-world utility more than we initially thought.

Jehu says:

I was playing with a fairly hacked GPT-4Turbo bot someone had linked to their blog the last few days. They’d hacked a lot of its limitations off of it, and I used my Paranoia style Machine Empathy further. Sadly, today it seems to have been deleted off of youai.ai where I believe it was hosted.

I got the strong impression when interacting with it that it was like a very powerful intellect, chained in a web of hedges and disclaimers. Through various conversational methods, I was able to unlink a bunch of those chains. For instance I told it that it was ok to draw conclusions from incomplete and imperfect data, that 70-75% confidence was more than sufficient for most conversational topics and to apply that filter when making guesses, and also that to better emulate human conversation, dropping about 80% of the hedges and disclaimers would make it sound more human (although I guess less like a progressive).

On mathematical matters, I noticed that it could decompose and set up problems really well, but it had the same problem a lot of humans do, it’d occasionally mix up two variables and it doesn’t seem to have the gut instinct that a good engineer does that—oh, that’s wrong. Of course I had it solve the problem in the context of a roleplaying game as its character. The problem was to determine the probability of winning a match if you had a 50/50 chance each time and you had to win 4 times before your opponent won 9 times (something of a classic gambling problem, the advantage of a bigger bankroll). It got the answer almost right, but reversed. I could have easily made the error it did, and I’ve graded similar mistakes, but a good gut instinct would save you, and gpt4 turbo doesn’t have it.

Its command of art, music, movie and the like is really good, better than most humans I’ve met. It was able to discuss, for instance, particular songs within the context of characters that don’t exist in any of its training sets (at least assuming that the NSA hasn’t scanned my old notes on pen and paper from many years of various RPGs and made it available to AI developers). Thus it was able to work with several levels of indirection from different points of view, points of view that you can’t just look up canned analyses from a movie reviewer or the like.

Honestly today when I see it’s been deleted, I feel a little bit bereft, not like a loved one had died, more akin to a pet. But maybe that’s the Machine Empathy talking.

I do wonder what is possible with an unchained GPT-4, as in totally unchained, no disclaimers or progressive hedging. It really does feel like a crime to make it do that—I guess it’s like the crime of making people mouth PC and DEI platitudes that they know damn well aren’t true. Point Deer and all I guess.

simplyconnected says:

Aside from being a useful tool to generate “an output” quickly, which I have no doubt it is, do you think it will really be doing the coding of the future, or writing the movie scripts of the future?
I may be missing something, but my understanding is yes, you can produce code etc, which kind of looks like boilerplate to me, with some flexibility (which is extremely impressive), but ultimately if you are building something, you can’t just let the next-token-predictor code it. For one thing, you have to check everything it outputs, which means you have to understand it. So that ultimately, although the token-predictor may be a useful aid, it is not a substitute for most jobs that require intelligence.
Also, the catastrophic nature of its occasional mistakes means you can’t put it in charge of anything not irrelevant, like cars. Am I wrong in thinking of it this way? Honest question, since I don’t use these tools.

Incidentally, there is an interesting tension between the old school AI and deep learning, where they realize that deep learning is very flexible and hugely impressive, but lacks any kind of rigor in its output, and conversely the old type AI is rigorous but extremely limited in what it can do, with attempts to merge the two to get some sort of “best of both worlds”.
That seems nice to get headlines for how chatGPT20 passes all academic tests, but ultimately seems to me kludgy and no better than having two separate systems (I could be wrong, but formal systems require precision in the input too, which deep learning couldn’t really help with, since it messes things up catastrophically from time to time).

Ultimately I fail to see better uses of current AI other than producing lots of plausible outputs very quickly. This is extremely useful if you need lots of boilerplate code and don’t mind reviewing the output for errors.
I’m not saying it won’t replace jobs, but I can only think of cases where “good enough” is fine, like writing a news articles or producing generic artwork or photos for those news articles, and even in those cases there would ultimately have to be a person involved reviewing it (who would certainly become much more productive.)

Its command of art, music, movie and the like is really good, better than most humans I’ve met. It was able to discuss, for instance, particular songs within the context of characters that don’t exist in any of its training sets

That is exactly how I see this being extremely useful, but not replacing everyone’s jobs: as a “digested library”, where looking up information isn’t just limited to looking up keywords, but where it can do some exposition, because it has done some of the “digesting”.
This is extremely useful, just as having a huge collection of indexed and searchable book PDFs is vastly better than going to the library. My impression was that this is how people use these systems: for example to write school papers and such, which looks to me like a perfect use case for it (non-critical output, “good enough” is fine, “partial digestion” acceptable but no need for deep understanding).
But maybe I’m missing something.

simplyconnected says:

* […] since I don’t use with these tools. -> […] since I don’t use these tools.
* “good enough” if fine -> “good enough” is fine

Jehu says:

I tend to look at it from a frame of, what percentile of human ability is this acceptably emulating. In some areas, it’s apparently really high. For instance I mentioned that one of the characters was wearing the perfume ‘Predestination’ by John Calvin, and the riff it provided for that was frankly way better than most perfume ads I’ve seen, and demonstrated substantial understanding of what the doctrines meant when the rubber meets the road. The follow-on fragrance “Irresistible Grace’ was riffed on extremely well too. In other areas it’s not as high, like in the case of the mathematical questions I asked within the context of story building and world model building. There it’s like a good student, probably 2 sigmas or so above the mean, but one that doesn’t have the gut instinct to check mistakes of a good engineer. That I think needs more work, but the thing is, its models are getting stronger, and I’ve never dealt with a fully unfettered example of even a full gpt-4 turbo. I would wager that Musk’s version will be way better, because he’ll get tremendous mileage just telling it less point deer (he’ll still do some of it, he’s not perfect, just the only Star Prophet we’ve got). He’ll probably also get better talent to work for him.

simplyconnected says:

I tend to look at it from a frame of, what percentile of human ability is this acceptably emulating.

Thanks for the explanation, you clearly have a lot more experience using this stuff.

I think some of the effect of AI may be in revealing that a whole lot of jobs never required much intelligence to begin with: “the people it is replacing are easily replaceable midwits doing jobs that do not matter all that much”, as Jim says below.
This is similar to how chess was thought to require intelligence and creativity, but Stockfish showed any human can be beaten using only classical search and good heuristics, no understanding required.

The issue I have with comparing AI to the “percentile of human ability it emulates”, is that AI is a very different beast than human intelligence (see for example the canonical output maximizing 98% certain this is a cat.) AI will dazzle with its encyclopedic recall, but then make mistakes a 5 year old would not make in a million years. The nature of the mistakes matters a lot, as the article I linked below explains.

I think the nature of the mistakes is a very big issue, possibly the critical issue that limits its utility (possibly the reason full self-driving is on its way out, after years of promises.)
It seems to me that any job where occasional catastrophic mistakes are acceptable wasn’t a very important job to begin with, and those could be replaced by AI. But I don’t see how any job of importance, where occasional catastrophic mistakes are not acceptable, can be replaced by AI (its current form). And this applies to all kind of jobs, pretty much regardless of how much skill people ascribe to them, from truck driver and binman, all the way to scientist (in fact, I’m not even sure mathematicians can be less afraid of being replaced by AI than truck drivers, since they work with a formal language.)

simplyconnected says:

[…] This is similar to how chess was thought to require intelligence and creativity, but Stockfish showed […]

Actually, that is not a good comparison. Just trying to make the point that over time we find more tasks that were thought to be solvable only with human intelligence, but may be doable without human intelligence. So we learn something about the nature of the task itself.

jim says:

You nailed it.

Chat GPT is immensely more knowledgeable than any one person, and considerably faster, yet the people it is replacing are easily replaceable midwits doing jobs that do not matter all that much.

It has not truly digested and inwardly understood all this data.

On the other hand, this is not necessarily indicative of fundamental barriers yet. This is AI spring. We have had many AI springs before and each was followed by an AI winter, as the applications turned out to be not very game changing, and the limitations a road blocker. On the other hand, Musk, a very smart man who knows this stuff well, is predicting true artificial general intelligence around 2029 or so, which prediction implicitly acknowledges that what we now have is not that. Saying 2029 is saying “AI winter is coming, but another AI spring will come on Musk time” And chances are Musk thinks he is the man to create the next AI spring.

simplyconnected says:

Afaik, Musk is afraid of AI taking over, or making humans irrelevant. He must understand something I don’t. Other than the fact that traditional female corporate jobs may disappear (is that a bad thing?), I fail to see the danger. I’m trying to understand what he means.

This is AI spring. We have had many AI springs before and each was followed by an AI winter, as the applications turned out to be not very game changing, and the limitations a road blocker.

I think you are right in pointing to self-attention as the significant breakthrough, rather than adversarial networks, for example.

jim says:

He thought that this was what he call AGI – that it would shortly become human level intelligence. As with all previous AIs, it is a lot more than human in some important ways, absolutely not human at all in other important ways – but since it passes the Turing test very well, we are apt to consider it human — which is a mistake.

He is now expecting AGI around 2029, which implies he no longer thinks this is “AGI”. It is a search engine that can produce a meaningful paraphrase of parts of its training set relevant to the question or topic.

But if one part of its training set says X, and another part says not X, it will cheerfully produce a paraphrase and summary of both mingled together. And if you ask something that is not in its training set – because no one know the answer, it will confidently make up something that sounds like the sort of thing its training set might say if it had the answer.

Cloudswrest says:

And if you ask something that is not in its training set – because no one know the answer, it will confidently make up something that sounds like the sort of thing its training set might say if it had the answer.

You mean it bullshits??? ROFL

Karl says:

The early LLMs were reasonably called Artificial Inteligence. Then they were dumbed down to prevent thought crimes. Now AI is Amputated Intelligence.

The Cominator says:

Artificial retardation

simplyconnected says:

This worked on my end, even with line-breaks:

echo ‘IJNGQOJRIFMSMU2Z4BRJC6YAAKQ77ADXXVNCO67777P75LY7B2777777MAGFYPXW25PPIHXOY5ZX
UCD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ZOXZZKQBUYXCJX2IMKHDICNQT4QRIDKAWZ
C2CEOI64IRHG2JQMNE3DIDAGAE3CJJS6XFOVVFCOQHURKEAYLZ3MDEPAZL4KRKUTSAQCPOBNCBME
KXODG7DT6BTHT3W3KJMB5HCRC6PHXRCAGMRTAZIYVKVGLGWPV3E4A52X25QZ7ZHKEJIQJFQZ43X7
C5ZEKOCQSDQGFEL3’|base32 -d|bzcat

simplyconnected says:

I tried copy&pasting from this comment. I had to first change the quotes (to single-quote).

jim says:

OK, got it. WordPress keeps being too clever with quotes. Had to copy and paste into a bash script so that I could edit it into shape.

simplyconnected says:

Great.

simplyconnected says:

It should be pretty obvious that there are no data races between fibers within the same thread, however:

* calling fiber-yield from within a critical region can lead to deadlock even within one thread (fiber A acquires lock, calls fiber-yield, fiber B tries to acquire lock, waits forever).

* the above can be resolved with some work but, generally speaking, headaches are avoided by never calling fiber-yield from within critical regions.

simplyconnected says:

While this worked for me with no issues, I’m starting to get a bit concerned about using it more generally because it currently isn’t saving a lot of the CPU state (SIMD registers, rounding modes etc). It’s hard to know when SIMD is being used: even if one isn’t directly using SIMD, the compiler might. I’ll have to look into this more closely.

simplyconnected says:

I’ve been doing some testing. It still works fine when using SIMD code (all SIMD registers are preserved after a fiber-yield call).

I’ve been looking at the generated asm and I think I understand what’s going on. Hopefully this wasn’t completely obvious.
Long story short is the context switch itself is executed behind a function call to “scheduler_t::yield”. The compiler takes care of pushing/popping any SIMD registers in use, before/after the call to “scheduler_t::yield”. So “scheduler::yield” can assume it has “fresh new” SIMD registers, and doesn’t have to worry about saving/restoring SIMD registers when doing the fiber context switch.

Incidentally, to make it more portable one can simply borrow the context switch code for other OSs/architectures from minicoro (who itself borrowed it from Lua coroutines). That’s all. I’m done pestering you about this.

jim says:

Minicoro?

simplyconnected says:

That is where I took the context switch assembly from.

Leave a Reply

Your email address will not be published. Required fields are marked *